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

From: Chris Travers <chris(dot)travers(at)gmail(dot)com>
To: Alban Hertroys <haramrae(at)gmail(dot)com>
Cc: Divyaprakash Y <divyaprakash(dot)y(at)celstream(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Create view is not accepting the parameter in postgres functions
Date: 2012-06-13 07:16:15
Message-ID: CAKt_Zfs33QzLnk4z=um-acys=m9NOY3n--rjA0a_Q7Qs-NuSqw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jun 13, 2012 at 12:06 AM, Alban Hertroys <haramrae(at)gmail(dot)com> 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 VIEW "A"  AS SELECT * FROM "B" WHERE "Id" = $1;
>
>
> Positional parameters ---------------------------------------------^^
>

> You can't mix those. I don't think SQL functions support named parameters, so using positional parameters throughout would be the solution.

Funny, we have been mixing in this way since at least Pg 8.1 with no
problems just because the names are of semantic value to the
application, and SQL language functions don't support named arguments.
If this ever changes, I would certainly hope that the SQL language
functions would first be given named argument support.

You used to be able to mix directly in plpgsql iirc but I don't know
if that's still the case.

Best Wishes,
Chris Travers

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2012-06-13 07:16:25 Re: Getting this error
Previous Message Craig Ringer 2012-06-13 07:12:49 Re: Create view is not accepting the parameter in postgres functions