psql variable to plpgsql?

From: Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>
To: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: psql variable to plpgsql?
Date: 2018-04-11 06:51:32
Message-ID: 20180411085132.709474uere5b7qko@www.gelassene-pferde.biz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all

Is there a way to pass the value of a psql variable into function
code? I create a schema with help of psql variable

\set SCHEMA_NAME LOGGER
create
schema :SCHEMA_NAME;

I would like to create a function that has the Schema hard coded like
declare
V_SCHEMA_NAME text := :SCHEMA_NAME;
begin
but as the plpgsql code is within quotes, it Fails.

Kind regards

Thiemo

--
Öffentlicher PGP-Schlüssel:
http://pgp.mit.edu/pks/lookup?op=get&search=0x8F70EFD2D972CBEF

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavan Deolasee 2018-04-11 06:51:40 Re: ERROR: found multixact from before relminmxid
Previous Message Thiemo Kellner 2018-04-11 06:44:17 dblink: give search_path