Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 2261A1FE6211 for ; Sun, 15 Jan 2012 14:28:02 -0400 (AST) Received: from mail-qw0-f53.google.com ([209.85.216.53]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RmUoA-0001Fq-LU for pgsql-sql@postgresql.org; Sun, 15 Jan 2012 18:28:03 +0000 Received: by qadc16 with SMTP id c16so889138qad.19 for ; Sun, 15 Jan 2012 10:27:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=XR3dL0YPRn9kSBCku3Xweh1FVg+drClETqV6tg4qOi0=; b=j7+17ELiNereAw9nMyA55IYsuRMQtW5vPJUt7Cbuty5wkt5k2Lncyv7xWMp54v7PSe Bw0E1LT7EmZrhqeWKX0z3GIGemxJToK0HrCrFoX0dL1jJo5gMCn2emHVIbxtrG2prAKe kWj7BdYZwpWf2S26nqKagBsPM+1tES1HzMjnU= Received: by 10.224.212.134 with SMTP id gs6mr10881978qab.32.1326652066133; Sun, 15 Jan 2012 10:27:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.248.70 with HTTP; Sun, 15 Jan 2012 10:27:05 -0800 (PST) In-Reply-To: <1326649045251-5146739.post@n5.nabble.com> References: <1326648533548-5146721.post@n5.nabble.com> <1326649045251-5146739.post@n5.nabble.com> From: Pavel Stehule Date: Sun, 15 Jan 2012 19:27:05 +0100 Message-ID: Subject: Re: Call function with dynamic schema name To: IlGenna Cc: pgsql-sql@postgresql.org Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -1.5 (-) X-Archive-Number: 201201/61 X-Sequence-Number: 36232 2012/1/15 IlGenna : > Can you provide me e little example plz? CREATE SCHEMA s1; CREATE SCHEMA s2; CREATE TABLE s1.a1(a int); CREATE TABLE s2.a1(a int); CREATE OR REPLACE FUNCTION s1.fx1() RETURNS int AS $$ BEGIN RETURN (SELECT MAX(a) FROM s1.a1); END $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION s2.fx1() RETURNS int AS $$ BEGIN RETURN (SELECT MAX(a) FROM s2.a1); END $$ LANGUAGE plpgsql; SET search_path TO s1; SELECT fx1(); -- returns max from s1.a1; SET search_path TO s2; SELECT fx1(); -- returns max from s2.s1; Regards Pavel Stehule > > Thanks in advance. > > Alessio > > -- > View this message in context: http://postgresql.1045698.n5.nabble.com/Call-function-with-dynamic-schema-name-tp5146721p5146739.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