Passing arguments to psql I'm running a plpgsql script in Postgres 8.3 - I would like to pass arguments to this script via psql. I'm currently executing the script like:

psql -d database -u user -f update_file.sql 


I came across This link which explains PGOPTIONS environment variable, but that doesn't work for "custom" arguments. i.e. I receive an error because the setting isn't listed in the postgres.conf file. 

-bash-3.2$ export PGOPTIONS='--pretend=true'
-bash-3.2$ psql -d my_db -f update_database.sql
psql: FATAL:  unrecognized configuration parameter "pretend"


Any other ideas? Ideally I'd like to avoid environment variables...
To add another functionality for -v... If you're trying to add the quotation, add it in the command line:

psql -v action="'drop'"


and this will run the code for:

select * where :action;


The same as

select * where 'drop';