Re: getting back autonumber just inserted

Поиск
Список
Период
Сортировка
От PFC
Тема Re: getting back autonumber just inserted
Дата
Msg-id op.stkqsbzith1vuj@localhost
обсуждение исходный текст
Ответ на Re: getting back autonumber just inserted  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: getting back autonumber just inserted  (Michael Fuhr <mike@fuhr.org>)
Re: getting back autonumber just inserted  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-sql
> On Fri, Jul 08, 2005 at 01:56:26AM +0200, PFC wrote:
>> >Do you mean with lastval()?  Here's what happens:
>>
>> Hm, interesting, you mean the return value of lastval() also depends
>> if  you set your constraints  to deferred or immediate ?
>
> My mind's ablank trying to contrive a situation where that would
> matter.  Can you provide an example?
It's rather perverse and farfetched, but what would stop one from putting  
some insert statements in a function that happens to be called somewhere  
inside of a check constraint... although one could agree that it's a bit  
shooting oneself in the foot...

> In any case, I simply meant to point out that 8.1's lastval() will
> be seductively convenient because you don't have to pass it a
> sequence name, but the value it returns might not be the value you
> want.
It's the first time I see a MySQLism in postgres !However I like it, cos it might subvert some MySQL users, and provide

 
easy answers to The Weekly Question on the mailing list (ie where is  
AUTO_INCREMENT) ?I've just noticed that I forgot a close() somewhere hence my data import  
files missed a few chunks at the end and MySQL said "3 warnings, 0 errors"  
(if it had failed I would have noticed it a week ago but no, more  
0000-00-00:00:00:00 hand pruning for me now). Uh oh, SHOW WARNINGS isn't  
implemented in that version. There are warnings, but I won't tell you  
where. Somewhere. Hm... grep logs ? yeah, but the error message doesn't  
mention the table name... nor what kind of warning it is that is not an  
error even though half of the row has stayed in an unclosed() file  
buffer...




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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Make COUNT(*) Faster?
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: getting back autonumber just inserted