RE: arguments for query files - Mailing list pgsql-sql

From Jeff Eckermann
Subject RE: arguments for query files
Date
Msg-id 08CD1781F85AD4118E0800A0C9B8580B094AEF@NEZU
Whole thread Raw
In response to arguments for query files  (david.brown@mviva.net (David Brown))
List 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.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)


pgsql-sql by date:

Previous
From: "Richard Huxton"
Date:
Subject: Re: Using the extract() function in plpgsql
Next
From: Najm Hashmi
Date:
Subject: Correct syntex for implicit curor in for loops