Skip site navigation (1) Skip section navigation (2)

Error when creating a char column as primary key

From: Gavin Reade <gavin(dot)reade(at)innogy(dot)com>
To: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Error when creating a char column as primary key
Date: 2002-11-21 15:26:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Hi folks,

Complete novice here!

I am trying to create a table as;

CREATE TABLE table (serial_no VARCHAR[16] PRIMARY KEY, date date DEFAULT

when I issue this command postgres returns an error saying;

ERROR: Can't find a default operator class for type 1015

I tried this as well;

CREATE TABLE table (serial_no VARCHAR[16] PRIMARY KEY NOT NULL, date date
DEFAULT current_date)

but I get the same error.

I guess that postgres is telling me that if there is no default value then
you can't assign a primary key to the column.

Is this the case or is there a work around that I can use without assigning
a SERIAL type to another column as the primary key?



The information contained in this email is intended only for the 
use of the intended recipient at the email address to which it 
has been addressed. If the reader of this message is not an 
intended recipient, you are hereby notified that you have received 
this document in error and that any review, dissemination or
copying of the message or associated attachments is strictly 

If you have received this email in error, please contact the sender
by return email or call 01793 877777 and ask for the sender and 
then delete it immediately from your system.

Please note that neither Innogy nor the sender accepts any 
responsibility for viruses and it is your responsibility to scan 
attachments (if any).

pgsql-novice by date

Next:From: Devinder K RajputDate: 2002-11-21 15:31:51
Subject: Re: Error when creating a char column as primary key
Previous:From: paul butlerDate: 2002-11-21 07:49:59
Subject: Re: pg_connect() unable to connect to pgsql server

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group