Re: Pass parameters to SQL script

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Fuchs Clemens <clemens(dot)fuchs(at)siemens(dot)com>
Cc: "'Daniel Martini'" <dmartini(at)uni-hohenheim(dot)de>, pgsql-general(at)postgresql(dot)org
Subject: Re: Pass parameters to SQL script
Date: 2004-08-19 15:07:49
Message-ID: 200408191707.49177.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am Donnerstag, 19. August 2004 15:39 schrieb Fuchs Clemens:
> Now I want to concatenate a variable value with a "hardcoded" value in my
> script - something like:
>
> CREATE TABLE :myValue + _the_hardcoded_string ......

Option 1:

\set tmp :myValue 'hardcoded'
CREATE TABLE :tmp ...

Option 2:

CREATE TABLE :myValue
"hardcoded" ...

If myValue is double quoted, then the values will automatically be
concatenated by the backend parser, but for strange (SQL-standard) reasons
you need a line break in between.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tino Wildenhain 2004-08-19 15:27:10 Re: libpq: passwords WAS: scripting & psql issues
Previous Message Anony Mous 2004-08-19 14:55:24 Re: select count(*) from pg_stat_activity in V8.0.0