Re: Odd behavior with 'currval'

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Odd behavior with 'currval'
Дата
Msg-id 558062c9-1167-f0c7-eed0-c71eb9edf5bd@aklaver.com
обсуждение исходный текст
Ответ на Re: Odd behavior with 'currval'  (Steven Hirsch <snhirsch@gmail.com>)
Список pgsql-general
On 02/08/2018 10:45 AM, Steven Hirsch wrote:
> On Thu, 8 Feb 2018, Melvin Davidson wrote:
> 
>> I believe your problem is in your usage.
>> In order for currval(regclass) to work, you must first do a
>> SELECT nextval(regclass) in your _current transaction_!
>>
>> https://www.postgresql.org/docs/9.6/static/functions-sequence.html
> 
> I AM doing that.  It is returning zero.  The code is identical to that 
> used in all other tables in the schema - all of them work.  This one 
> does not - unless I use the INSERT .. RETURNING ..  approach.
> 
> I suspect the weirdness with the sequence not being found is part of the 
> underlying problem.

I suspect that also, hence my previous suggestion:

\d udm_asset_type_definition_def_id_seq

This should show whether the sequence is 'owned' by the table.column.

> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Steven Hirsch
Дата:
Сообщение: Re: Odd behavior with 'currval'
Следующее
От: Steven Hirsch
Дата:
Сообщение: Re: Odd behavior with 'currval'