Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Perl and psql variables



Mark Campbell <mdc(at)ucs(dot)co(dot)za> writes:
> the perl script generates a variable called $month (which is the current 
> month), I then need that month variable passed as a command line line 
> parameter to psql. eg psql -f sql.file --variable "month = $month"
> then do a SELECT with the variable called :month

How about something like

	(
	  echo "\set :month = $month"
	  cat sql.file
	) | psql

			regards, tom lane



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group