Re: postgresql function not accepting null values inselect statement

From: "Robins Tharakan" <tharakan(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: postgresql function not accepting null values inselect statement
Date: 2008-02-25 06:56:35
Message-ID: 36af4bed0802242256i7f0e7a36i4f0cf4b567dfadc2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>
> What version of PostGreSQL are you using ?
> Are you sure there was no typing error ? This SQL should work in the most
> recent version of PG.( at least version 8.1 onwards)
>
> *Robins*
>
>
> On Mon, Feb 25, 2008 at 10:50 AM, Jyoti Seth <jyotiseth2001(at)gmail(dot)com>
> wrote:
>
> > I have tried this, but it is showing following error:
> > ERROR: syntax error at or near "DISTINCT"
> > SQL state: 42601
> >
> > Thanks,
> > Jyoti
> >
> >
> > -----Original Message-----
> > From: pgsql-sql-owner(at)postgresql(dot)org [mailto:
> > pgsql-sql-owner(at)postgresql(dot)org]
> > On Behalf Of johnf
> > Sent: Friday, February 22, 2008 10:01 PM
> > To: pgsql-sql(at)postgresql(dot)org
> > Subject: Re: [SQL] postgresql function not accepting null values
> > inselect
> > statement
> >
> > On Friday 22 February 2008 01:35:47 am Bart Degryse wrote:
> > > Can you try this...
> > >
> > > CREATE OR REPLACE FUNCTION getfunctionaries(p_statecd integer)
> > > RETURNS SETOF t_functionaries AS
> > > $BODY$
> > > DECLARE
> > > rec t_functionaries%ROWTYPE;
> > > BEGIN
> > > FOR rec IN (
> > > SELECT f.functionaryid, f.category, f.description
> > > FROM functionaries f
> > > WHERE f.statecd IS NOT DISTINCT FROM p_statecd)
> > > LOOP
> > > return next rec;
> > > END LOOP;
> > > return;
> > > END;
> > > $BODY$
> > > LANGUAGE 'plpgsql' VOLATILE;
> > >
> > a newbie question. Could you explain why yours works? I don't
> > understand
> > how
> > it works if p_statecd = NULL
> >
> >
> > --
> > John Fabiani
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Have you searched our list archives?
> >
> > http://archives.postgresql.org
> >
>
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stuart Brooks 2008-02-25 06:57:13 Re: autovacuum not freeing up unused space on 8.3.0
Previous Message Stuart Brooks 2008-02-25 06:27:17 autovacuum not freeing up unused space on 8.3.0