From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: How to define variables in psql? |
Date: | 2006-01-31 13:20:48 |
Message-ID: | 20060131132048.GE30209@webserv.wug-glas.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
am 31.01.2006, um 7:17:17 -0500 mailte kynn(at)panix(dot)com folgendes:
>
>
>
> I know that one can store multiple psql commands and SQL statements in
> a separate "script" file, and then "source" the script file, e.g. with
> the \i command.
>
> My question is, can I define variables in such a script file?
> E.g. can I do something like the following unix-shell-like script?
>
> -- beginning of script
>
> DB=frobozz
> DIR=/foo/bar/baz/quux
something like this:?
\set DIR /home/kretschmer/
\set file :DIR foobar.sql
\set DB FOOBAR
\i :file
\echo "done with " :DB
HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47215, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===
From | Date | Subject | |
---|---|---|---|
Next Message | kynn | 2006-01-31 13:35:03 | Re: How to define variables in psql? |
Previous Message | Tomka Gergely | 2006-01-31 12:51:30 | lost archives, alpha data files |