Re: sequences what does ::text mean ? - Mailing list pgsql-novice

From Oliver Elphick
Subject Re: sequences what does ::text mean ?
Date
Msg-id 1025693889.14876.5.camel@linda
Whole thread Raw
In response to Re: sequences what does ::text mean ?  (Ewald Geschwinde <webmaster@geschwinde.net>)
List pgsql-novice
On Wed, 2002-07-03 at 11:05, Ewald Geschwinde wrote:
> Henk Schets wrote:

> >In a table I have as a default value nextval('seq_auteurs').  What's
the difference with nextval('seq_auteurs'::text) ?

> The difference ist nextval('seq_autheurs') you get an integer back and
> with the second one it casts the integer to text and returns a text value

That would be "nextval('seq_auteurs')::text", with the cast outside the
parentheses.

"nextval('seq_auteurs'::text)" converts 'seq_auteurs' to text before
using it to identify the sequence for nextval().  Since 'seq_auteurs' is
already text, this is a null operation.

Oliver




pgsql-novice by date:

Previous
From: Ewald Geschwinde
Date:
Subject: Re: sequences what does ::text mean ?
Next
From: Andrew McMillan
Date:
Subject: Re: sequences what does ::text mean ?