Re: psql variable to plpgsql?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: psql variable to plpgsql?
Date: 2018-04-11 07:16:02
Message-ID: CAFj8pRBN1s0EJcbRde-iRJRkd8Bnk_rdJsgmxEasvybmC+SqoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

2018-04-11 8:51 GMT+02:00 Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>:

> 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.
>

No, there is not possible to read/write client side variables from server
side.

Regards

Pavel

>
> 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.
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2018-04-11 07:25:52 Re: Suggest the best values for the postgres configuration parameters
Previous Message Thomas Poty 2018-04-11 07:14:40 Re: Barman versus pgBackRest