Expanding psql variables - Mailing list pgsql-general

From mephysto
Subject Expanding psql variables
Date
Msg-id 1328109870909-5447801.post@n5.nabble.com
Whole thread Raw
List 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.

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Issue with CREATE EXTENSION tablefuncKreiter
Next
From: Tom Lane
Date:
Subject: Re: Issue with CREATE EXTENSION tablefuncKreiter