Re: sequences what does ::text mean ?

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Ewald Geschwinde <webmaster(at)geschwinde(dot)net>
Cc: Henk Schets <henk(at)poppunt(dot)be>, pgsql-novice(at)postgresql(dot)org
Subject: Re: sequences what does ::text mean ?
Date: 2002-07-03 10:58:09
Message-ID: 1025693889.14876.5.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Andrew McMillan 2002-07-03 10:58:14 Re: sequences what does ::text mean ?
Previous Message Ewald Geschwinde 2002-07-03 10:05:18 Re: sequences what does ::text mean ?