Michael Glaesemann wrote: > > On Jan 14, 2006, at 23:54 , Jeff Boes wrote: > >> Tony Wasson wrote: > >> >> Sure, but that was not my question. I want to be able to set the >> variable on the command line, BUT have it default to a value inside >> the SQL script if not present on the command line. > > You could write a wrapper script that would accept a command line > argument and load the file with the appropriate SET statement prepended.
Which really gains me nothing over just: $ psql -f myscript.sql -v "MYVAR=${myvar:-default}" The original question was: how can I store the default value in the "myscript.sql" script where it's used, rather than have it in a calling script? The aim here was to put the default in the code, so they would be bound together... -- Jeffery Boes <>< [EMAIL PROTECTED] ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend