Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Merlin Moncure
On Wed, Jun 13, 2012 at 12:25 PM, Tom Lane wrote: > Merlin Moncure writes: >> The CREATE VIEW statement does not allow parameterized arguments >> apparently. > > Well, no.  What would it mean?  The view is likely to outlast the > existence of the function argument. right -- it's quite sensible e

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Tom Lane
Merlin Moncure writes: > The CREATE VIEW statement does not allow parameterized arguments > apparently. Well, no. What would it mean? The view is likely to outlast the existence of the function argument. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Merlin Moncure
On Wed, Jun 13, 2012 at 12:31 AM, Divyaprakash Y wrote: > > Hi, > > > > Is the following postgres function correct? > > > > CREATE OR REPLACE FUNCTION "MyFun"("IdArgs" INTEGER) > >     RETURNS SETOF "B" AS > > $BODY$ > >     CREATE VIEW "A"  AS SELECT * FROM "B" WHERE "Id"

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Misa Simic
rom the named parameter? >> 2. I am able to use positional parameters in sql functions as in >> PL/PgSQL function. This is the only case [create view] in which I could >> not succeed. >> 3. Which would be faster..temp table or view? >> >> >> -Original Mess

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Misa Simic
y case [create view] in which I could > not succeed. > 3. Which would be faster..temp table or view? > > > -Original Message- > From: Craig Ringer [mailto:ring...@ringerc.id.au] > Sent: Wednesday, June 13, 2012 12:39 PM > To: Divyaprakash Y > Cc: pgsql-general@postgre

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Divyaprakash Y
13, 2012 12:39 PM To: Divyaprakash Y Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Create view is not accepting the parameter in postgres functions On 06/13/2012 01:31 PM, Divyaprakash Y wrote: > CREATE OR REPLACE FUNCTION "MyFun"("IdArgs" INTEGER) >

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Thomas Kellerer
Chris Travers, 13.06.2012 09:16: If this ever changes, I would certainly hope that the SQL language functions would first be given named argument support. This is coming in 9.2 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Chris Travers
On Wed, Jun 13, 2012 at 12:06 AM, Alban Hertroys wrote: > On 13 Jun 2012, at 7:31, Divyaprakash Y wrote: > >> Hi, >> >> Is the following postgres function correct? >> >> CREATE OR REPLACE FUNCTION "MyFun"("IdArgs" INTEGER) > > Named parameters ^^^ > > >>                CREATE V

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Craig Ringer
On 06/13/2012 03:06 PM, Alban Hertroys wrote: > Named parameters ^^^ Positional parameters -^^ You can't mix those. I don't think SQL functions support named parameters, so using positional parameters throughout would be the solut

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Craig Ringer
On 06/13/2012 01:31 PM, Divyaprakash Y wrote: CREATE OR REPLACE FUNCTION "MyFun"("IdArgs" INTEGER) RETURNS SETOF "B" AS $BODY$ CREATE VIEW "A" AS SELECT * FROM "B" WHERE "Id" = $1; SELECT * FROM "B"; Executing “select * from "MyFun"(1) “ th

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Alban Hertroys
On 13 Jun 2012, at 7:31, Divyaprakash Y wrote: > Hi, > > Is the following postgres function correct? > > CREATE OR REPLACE FUNCTION "MyFun"("IdArgs" INTEGER) Named parameters ^^^ >CREATE VIEW "A" AS SELECT * FROM "B" WHERE "Id" = $1; Positional parameter

[GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-12 Thread Divyaprakash Y
Hi, Is the following postgres function correct? CREATE OR REPLACE FUNCTION "MyFun"("IdArgs" INTEGER) RETURNS SETOF "B" AS $BODY$ CREATE VIEW "A" AS SELECT * FROM "B" WHERE "Id" = $1; SELECT * FROM "B"; $BODY$ LANGUAGE 'sql' VOLATILE