Skip site navigation (1) Skip section navigation (2)

Re: int8, primary key, seq scan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Amiel <jamiel(at)istreamimaging(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: int8, primary key, seq scan
Date: 2004-08-20 14:56:01
Message-ID: 21039.1093013761@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-general
Jeff Amiel <jamiel(at)istreamimaging(dot)com> writes:
> CREATE OR REPLACE FUNCTION public.insert_draft(int4,  numeric)
>   RETURNS draft AS
> 'DECLARE
>   passed_customer ALIAS for $1;
>   passed_amount ALIAS for $2;
>   draftid int8;
>   draftrow draft%rowtype;
> BEGIN
> insert into draft( amount, customer) values  (passed_amount, 
> passed_customer);
> select into draftid currval(\'public.draft_check_id_seq\');
> select into draftrow * from draft where check_id=int8(draftid);
> return draftrow;
> END;'
>   LANGUAGE 'plpgsql' VOLATILE;

Hmm.  I put this function into 7.4.5, minus the explicit cast to int8,
and it worked just fine (I used a debugger to verify directly that the
last SELECT was producing an indexscan plan).  I don't see anything in
the CVS logs to suggest that there was a related bug fix between 7.4.2
and 7.4.5.  So I'm baffled why it didn't work for you.  Ideas anyone?

			regards, tom lane

In response to

pgsql-general by date

Next:From: Bruce MomjianDate: 2004-08-20 15:12:40
Subject: Re: How to setup default value "0000-00-00" for "date"
Previous:From: Jim WilsonDate: 2004-08-20 14:38:12
Subject: Re: How to setup default value "0000-00-00" for "date"

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group