Re: currval() without specifying the sequence name - Mailing list pgsql-sql

From Tom Lane
Subject Re: currval() without specifying the sequence name
Date
Msg-id 25738.1078848640@sss.pgh.pa.us
Whole thread Raw
In response to Re: currval() without specifying the sequence name  (ow <oneway_111@yahoo.com>)
Responses Re: currval() without specifying the sequence name
List pgsql-sql
ow <oneway_111@yahoo.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


pgsql-sql by date:

Previous
From: Jeff Boes
Date:
Subject: Re: Dramatic slowdown of sql when placed in a function
Next
From: ow
Date:
Subject: Re: currval() without specifying the sequence name