Re: Call function with dynamic schema name

From: Misa Simic <misa(dot)simic(at)gmail(dot)com>
To: IlGenna <alessio(dot)gennari78(at)gmail(dot)com>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Call function with dynamic schema name
Date: 2012-01-15 22:36:23
Message-ID: 2604666127334102118@unknownmsgid
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

You could take a look on EXECUTE command in plpgsql...

Depends on concrete problem but should be very careful with dynamic SQL
because of SQL injection potential risk...
Kind Regards,

Misa

Sent from my Windows Phone
From: IlGenna
Sent: 15/01/2012 18:29
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] Call function with dynamic schema name
Hi to everyone,
I would like to use in my function (plpgsql or sql) dynamic schema name to
execute query or to call other functions.

For exemple in oracle is possible to excute query in this manner:

SELECT * FROM &&SCHEMA_NAME..TABLE_NAME;

Where I think &&SCHEMA_NAME. is a sessione variable.

I found tath I can use dynamic SQL like this:

execute 'select * from ' || schema_name || '.table_name';

However, I would like to know if exist any other system to use dynamic
schema name more similiar to Oracle. Another pl language is also ok.

Thank you very much.

Alessio

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Call-function-with-dynamic-schema-name-tp5146721p5146721.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.

Browse pgsql-sql by date

  From Date Subject
Next Message Misa Simic 2012-01-15 22:49:30 Re: sql query problem
Previous Message Oliveiros 2012-01-15 21:13:18 Re: sql query problem