Re: [INTERFACES] ODBC CREATE TABLE failures
От | Thomas G. Lockhart |
---|---|
Тема | Re: [INTERFACES] ODBC CREATE TABLE failures |
Дата | |
Msg-id | 368C5FE8.5032023A@alumni.caltech.edu обсуждение исходный текст |
Ответ на | ODBC CREATE TABLE failures ("Michael J. Sheldon" <msheldon@cbrcomm.com>) |
Список | pgsql-interfaces |
> The application will automatically create the database structure if it > does not already exist > However, only the first table is being created. > Code follows: <snip> You can test this code by running it through psql, and it fails there too. Each CREATE TABLE statement is trying to use the same label for the primary key constraint, but since Postgres enforces the primary key by generating an implicit index this fails. Try using unique names for constraints! If for some reason these constraint names *must* be identical, you could consider modifying the code in the parser to generate a unique internal name based on both the constraint name and the table name, for example. There is already a routine there to help you do this. Failure example follows... - Tom postgres=> CREATE TABLE FMGroups postgres-> ( postgres-> GroupID INTEGER NOT NULL, postgres-> GroupName VARCHAR(64) NOT NULL, postgres-> Description VARCHAR(100), postgres-> CONSTRAINT ID_pk PRIMARY KEY (GroupID), postgres-> CONSTRAINT check_directory UNIQUE (GroupName) postgres-> ); NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index id_pk for table fmgroups NOTICE: CREATE TABLE/UNIQUE will create implicit index check_directory for table fmgroups CREATE postgres=> CREATE TABLE FMDirectories postgres-> ( postgres-> DirectoryID INTEGER NOT NULL, postgres-> DirectoryName VARCHAR(64) NOT NULL, postgres-> Description VARCHAR(100), postgres-> ParentID INTEGER NOT NULL, postgres-> CONSTRAINT ID_pk PRIMARY KEY (DirectoryID), postgres-> CONSTRAINT check_directory UNIQUE (DirectoryName) postgres-> ); NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index id_pk for table fmdirectories NOTICE: CREATE TABLE/UNIQUE will create implicit index check_directory for table fmdirectories ERROR: Cannot create index: 'id_pk' already exists
В списке pgsql-interfaces по дате отправления: