Re: currval() without specifying the sequence name

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: currval() without specifying the sequence name
Дата
Msg-id 25738.1078848640@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: currval() without specifying the sequence name  (ow <oneway_111@yahoo.com>)
Ответы Re: currval() without specifying the sequence name  (ow <oneway_111@yahoo.com>)
Список 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 по дате отправления:

Предыдущее
От: Jeff Boes
Дата:
Сообщение: Re: Dramatic slowdown of sql when placed in a function
Следующее
От: ow
Дата:
Сообщение: Re: currval() without specifying the sequence name