Обсуждение: arguments for query files

Поиск
Список
Период
Сортировка

arguments for query files

От
david.brown@mviva.net (David Brown)
Дата:
Does anybody know how I can pass arguments into files which I execute
from within psql using \i?

I want to be able to do something like:
\i file arg1 arg2


RE: arguments for query files

От
Jeff Eckermann
Дата:
I don't think this is possible in the way that you specify.
What works for me is to include psql variable names in the script file, then
set the values before each run.
psql variables are of the form " :<variable name> ".
To assign a value, just do " \set variable=value ".
I like to include lines at the end of my script to unset these values, of
the form " \unset variable ".
HTH.

> -----Original Message-----
> From:    david.brown@mviva.net [SMTP:david.brown@mviva.net]
> Sent:    Tuesday, June 19, 2001 12:06 PM
> To:    pgsql-sql@postgresql.org
> Subject:    arguments for query files
> 
> Does anybody know how I can pass arguments into files which I execute
> from within psql using \i?
> 
> I want to be able to do something like:
> \i file arg1 arg2
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)