Expanding psql variables

From: mephysto <mephystoonhell(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Expanding psql variables
Date: 2012-02-01 15:24:30
Message-ID: 1328109870909-5447801.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello to everyone,
I'm trying to use variables in psql script to create some stored funtions.
The problem is that psql variables are not expanded if it is into a dollar
quoted string. This is my example:

\set my_schema foo

CREATE OR REPLACE FUNCTION foo() RETURNS VOID AS
$BODY$
SELECT * FROM :my_schema.my_table;
$BODY$
LANGUAGE sql;

In this manner I receive a syntax error near:

The question is: is there a manner to expand psql script variables inside
dollar quoted string?

Thanks in advance.

Mephysto

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Expanding-psql-variables-tp5447801p5447801.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-02-01 15:52:14 Re: Issue with CREATE EXTENSION tablefuncKreiter
Previous Message Merlin Moncure 2012-02-01 14:58:16 Re: Issue with CREATE EXTENSION tablefuncKreiter