Re: Don't understand creation statement's answer - Mailing list pgsql-sql

From Mathijs Brands
Subject Re: Don't understand creation statement's answer
Date
Msg-id 20001218010855.B2054@ilse.nl
Whole thread Raw
In response to Don't understand creation statement's answer  (Thomas SMETS <tsmets@altern.org>)
List pgsql-sql
On Mon, Dec 18, 2000 at 12:32:54AM +0100, Thomas SMETS allegedly wrote:
> tsmets=> create sequence author_seq;
> CREATE  
> 
> tsmets=> create table author ( 
> tsmets=>     author_id numeric primary key default
> nextval('author_seq'),  
> tsmets=>     name char(25) not null, 
> tsmets=>     surname char(25) not null
> tsmets=>     );
> NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index
> 'author_pkey' for table 'author'

> Now the question is :
> What is the meaning of the following statement in the table description
> ?
> 
>  Attribute |     Type      |                   Modifier
> -----------+---------------+----------------------------------------------
>  author_id | numeric(30,6) | not null default
> nextval('author_seq'::text)
> 
> Why was my author_id changesdin a "nextval('author_seq'::text)".
> There's no text here ?

nextval takes one parameter of the type text. It's just an explicit typecast.
The output of nextval is a number, as you requested.

I hope this helps,

Mathijs
-- 
"Books constitute capital."     Thomas Jefferson 


pgsql-sql by date:

Previous
From: Thomas SMETS
Date:
Subject: Don't understand creation statement's answer
Next
From: Dan Vanags
Date:
Subject: sql/database admin courses