RE: arguments for query files

From: Jeff Eckermann <jeckermann(at)verio(dot)net>
To: "'david(dot)brown(at)mviva(dot)net'" <david(dot)brown(at)mviva(dot)net>, pgsql-sql(at)postgresql(dot)org
Subject: RE: arguments for query files
Date: 2001-06-21 14:48:30
Message-ID: 08CD1781F85AD4118E0800A0C9B8580B094AEF@NEZU
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(dot)brown(at)mviva(dot)net [SMTP:david(dot)brown(at)mviva(dot)net]
> Sent: Tuesday, June 19, 2001 12:06 PM
> To: pgsql-sql(at)postgresql(dot)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(at)postgresql(dot)org)

Browse pgsql-sql by date

  From Date Subject
Next Message Najm Hashmi 2001-06-21 15:43:12 Correct syntex for implicit curor in for loops
Previous Message Richard Huxton 2001-06-21 14:28:29 Re: Using the extract() function in plpgsql