Project

General

Profile

« Previous | Next » 

Revision 4548

input.Makefile: Staging tables installation: `%/install: %/create.sql`: Fixed bug where embedded \ in ADD COLUMN statement was not removed by the shell, because single quotes do not remove embedded \s

View differences:

input.Makefile
228 228
%/install %/header.csv: %/create.sql _always
229 229
	($(inDatasrc); echo 'CREATE TABLE "$*" AS'; cat $<; echo ';')|"time" \
230 230
$(psqlAsBien) --echo-all --set=table='"$*"' $(logInstall*)
231
	-echo 'ALTER TABLE "$(datasrc)"."$*" \
232
ADD COLUMN row_num serial NOT NULL PRIMARY KEY;'|$(psqlAsBien) $(logInstall*Add)
231
	-$(addRowNum)
233 232
	echo 'VACUUM ANALYZE "$(datasrc)"."$*";'|$(psqlAsBien) $(logInstall*Add)
234 233
	$(exportHeader)
235 234
# ignore errors if create.sql already added a primary key
235
addRowNum = echo 'ALTER TABLE "$(datasrc)"."$*"\
236
ADD COLUMN row_num serial NOT NULL PRIMARY KEY;'|$(psqlAsBien) $(logInstall*Add)
236 237

  
237 238
# The joined tables must be suffixed with ".src" to prevent the creation of a
238 239
# row_num column, which collides during joins.

Also available in: Unified diff