Re: currval() without specifying the sequence name

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ow <oneway_111(at)yahoo(dot)com>
Cc: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: currval() without specifying the sequence name
Date: 2004-03-09 16:10:40
Message-ID: 25738.1078848640@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

ow <oneway_111(at)yahoo(dot)com> writes:
> I guess I could but then:

> 1) I'd still have to know the sequence name. When integrating pgSql
> with 3party frameworks I'd either have to pass it there (could be a
> very difficult task) or make some assumptions (also not very good).

This scenario is really entirely ridiculous. You want your code to be
integrated with other code and not make any assumptions, but you are
willing to assume that only one sequence will be touched in any command,
or that the last one that's touched is the one you want?

It seems to me that this idea will render your code more fragile, not
less so.

> 3) If one sequence is used, in many cases it'll have to be of type int8 and
> pgSql does not handle searches with int8 very nicely.

Quote or cast and you're fine. But what does that have to do with
knowing a sequence name?

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message ow 2004-03-09 16:36:28 Re: currval() without specifying the sequence name
Previous Message Jeff Boes 2004-03-09 15:17:12 Re: Dramatic slowdown of sql when placed in a function