Project

General

Profile

« Previous | Next » 

Revision 4527

input.Makefile: Staging tables installation: `%/install: %/create.sql`: Ignore errors if create.sql already added a primary key

View differences:

inputs/input.Makefile
223 223

  
224 224
# For staging tables which are derived by joining together other staging tables.
225 225
%/install %/header.csv: %/create.sql _always
226
	($(inDatasrc); echo 'CREATE TABLE "$*" AS'; cat $<; echo ';'; \
227
echo 'ALTER TABLE "$*" ADD COLUMN row_num serial NOT NULL PRIMARY KEY;'; \
228
echo 'VACUUM ANALYZE "$*";')|"time" $(psqlAsBien) --echo-all \
229
--set=table='"$*"' $(call logInstall,$*/)
226
	($(inDatasrc); echo 'CREATE TABLE "$*" AS'; cat $<; echo ';')|"time" \
227
$(psqlAsBien) --echo-all --set=table='"$*"' $(call logInstall,$*/)
228
	-echo 'ALTER TABLE "$(datasrc)"."$*" \
229
ADD COLUMN row_num serial NOT NULL PRIMARY KEY;'|$(psqlAsBien)
230
	echo 'VACUUM ANALYZE "$(datasrc)"."$*";'|$(psqlAsBien)
230 231
	$(exportHeader)
232
# ignore errors if create.sql already added a primary key
231 233

  
232 234
# The joined tables must be suffixed with ".src" to prevent the creation of a
233 235
# row_num column, which collides during joins.

Also available in: Unified diff