Re: Error when creating a char column as primary key

From: "Devinder K Rajput" <Devinder(dot)Rajput(at)ipaper(dot)com>
To: "Gavin Reade" <gavin(dot)reade(at)innogy(dot)com>
Cc: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>, pgsql-novice-owner(at)postgresql(dot)org
Subject: Re: Error when creating a char column as primary key
Date: 2002-11-21 15:31:51
Message-ID: OF40FB1327.44F399CD-ON86256C78.0055440E@ipaper.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


use VARCHAR(16) and not VARCHAR[16].

hth

Devinder Rajput
Stores Division Corporate Offices
Chicago, IL
(773) 442-6474


"Gavin Reade"
<gavin(dot)reade(at)innogy(dot)co To: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
m> cc:
Sent by: Subject: [NOVICE] Error when creating a char column as primary key
pgsql-novice-owner(at)pos
tgresql.org


11/21/2002 09:26 AM

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
current_date)

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?

Thanks,

greadey

****************************************************************************

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
prohibited.

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).
*****************************************************************************

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2002-11-21 16:04:13 Re: Error when creating a char column as primary key
Previous Message Gavin Reade 2002-11-21 15:26:39 Error when creating a char column as primary key