FAQ
hello everybody!!

i am trying to emulate mysql enum's by creating another table, putting
in the allowed values for the enum, and creating a REFERENCE CONSTRAINT
to it. So, i have the created reference table:

mod=# \d qp_qualchoice_goodchoice_constraint_table;
Table "mod_schema.qp_qualchoice_goodchoice_constraint_table"
Column | Type | Modifiers
------------+----------------------+-----------
goodChoice | character varying(3) | not null
Indexes:
"qp_qualchoice_goodchoice_constraint_table_pkey" PRIMARY KEY, btree
("goodChoice")

mod=# select * from qp_qualchoice_goodchoice_constraint_table;
goodChoice
------------
n
y
(2 rows)

mod=# \q


but when i try to do the following table which references it........

--
-- Table structure for table qp_qualchoice
--

CREATE TABLE qp_qualchoice (
"qid" int2 NOT NULL default '0',
"choiceid" int2 NOT NULL default '0',
"goodChoice" varchar CONSTRAINT qp_qualchoice_goodChoice_constraint
REFERENCES qp_qualchoice_goodChoice_constraint_table (goodChoice)
default 'n',
"choiceText" text NOT NULL,
"addate" date default NULL,
"moddate" date default NULL,
"battery_id" varchar(15) default 'klpt4'
) ;


i get this error:

psql:pg_sql.sql:44: ERROR: column "goodchoice" referenced in foreign
key constraint does not exist


BUT THAT COLUMN EXISTS, so where is my mistake?

thanks to all.....

joseph.



--
<a href="http://openandout.com/~jcs/">who am I?</a>.

Search Discussions

  • Andreas Kretschmer at Jun 15, 2006 at 2:24 pm

    am 15.06.2006, um 23:18:58 +0900 mailte kmh496 folgendes:
    Column | Type | Modifiers
    ------------+----------------------+-----------
    goodChoice | character varying(3) | not null ^
    'C'

    REFERENCES qp_qualchoice_goodChoice_constraint_table (goodChoice)
    ^ ^
    my guess: you need there "

    psql:pg_sql.sql:44: ERROR: column "goodchoice" referenced in foreign ^
    'c'


    HTH, Andreas
    --
    Andreas Kretschmer (Kontakt: siehe Header)
    Heynitz: 035242/47215, D1: 0160/7141639
    GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
    === Schollglas Unternehmensgruppe ===

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedJun 15, '06 at 2:17p
activeJun 15, '06 at 2:24p
posts2
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

Andreas Kretschmer: 1 post Kmh496: 1 post

People

Translate

site design / logo © 2022 Grokbase