Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id A00161FE6212 for ; Sun, 15 Jan 2012 18:36:41 -0400 (AST) Received: from mail-iy0-f174.google.com ([209.85.210.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RmYgn-0005BM-Qt for pgsql-sql@postgresql.org; Sun, 15 Jan 2012 22:36:42 +0000 Received: by iagf6 with SMTP id f6so1543023iag.19 for ; Sun, 15 Jan 2012 14:36:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=gWtAiqrVNgo6w4f0ooH6yiYFR524UniCvlTD2Pv8XTM=; b=flegGlsBNBV31jBHtOQ9fAd8iGc53ngJb9WVXkrsb9L5MTc/TjDqo7tifFN3J+fhf6 bqWQUGxNCKg3A8o8eKNmQ5xQhzlSNwL//d4PWg4XHO8qh2QC9s6oQKcNoh7ONwxzn02n AhpN2l+OlO38DPQrj4R3CqADr1wMVQvfS9lXM= Received: by 10.50.10.225 with SMTP id l1mr10353112igb.9.1326666983556; Sun, 15 Jan 2012 14:36:23 -0800 (PST) MIME-Version: 1.0 From: Misa Simic Date: Sun, 15 Jan 2012 14:36:23 -0800 Message-ID: <2604666127334102118@unknownmsgid> Subject: Re: Call function with dynamic schema name To: IlGenna , "pgsql-sql@postgresql.org" Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -1.5 (-) X-Archive-Number: 201201/64 X-Sequence-Number: 36235 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@postgresql.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. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql