Re: Error when creating a char column as primary key

Поиск
Список
Период
Сортировка
От Devinder K Rajput
Тема Re: Error when creating a char column as primary key
Дата
Msg-id OF40FB1327.44F399CD-ON86256C78.0055440E@ipaper.com
обсуждение исходный текст
Ответ на Error when creating a char column as primary key  (Gavin Reade <gavin.reade@innogy.com>)
Ответы Re: Error when creating a char column as primary key
Список pgsql-novice
use VARCHAR(16) and not VARCHAR[16].

hth

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



                    
                      "Gavin Reade"
                    
                      <gavin.reade@innogy.co        To:       "'pgsql-novice@postgresql.org'"
<pgsql-novice@postgresql.org>                 
                      m>                            cc:
                    
                      Sent by:                      Subject:  [NOVICE] Error when creating a char column as primary key
                    
                      pgsql-novice-owner@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@postgresql.org)







В списке pgsql-novice по дате отправления:

Предыдущее
От: Gavin Reade
Дата:
Сообщение: Error when creating a char column as primary key
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Error when creating a char column as primary key