Re: Argh! What's a 'bpchar'? (copy/serial issues...I think)
| От | Tom Lane |
|---|---|
| Тема | Re: Argh! What's a 'bpchar'? (copy/serial issues...I think) |
| Дата | |
| Msg-id | 6312.979871228@sss.pgh.pa.us обсуждение |
| Ответ на | Argh! What's a 'bpchar'? (copy/serial issues...I think) (Ken Corey <ken@kencorey.com>) |
| Список | pgsql-novice |
Ken Corey <ken@kencorey.com> writes:
> CREATE TABLE PLAYER
> (
> PLAYER_ID SERIAL,
> PLAYER_NAME varchar(255) NOT NULL,
> PLAYING_FOR varchar(255) NOT NULL,
> CHEAT_FLAG char(1) NULL,
> EMAIL varchar(255) NULL,
> --UNIQUE (PLAYER_NAME,PLAYING_FOR,EMAIL),
> CONSTRAINT PK_PLAYER PRIMARY KEY (PLAYER_ID)
> )
> ;
> with this command:
> GRE=# copy player from '/tmp/player.txt' using delimiters ',';
> ERROR: Unable to identify an operator '=' for types 'bpchar' and
> 'varchar'
"bpchar" is the internal type name for CHAR(n) (think "blank-padded
char"). It's unhappy because something is trying to compare a
char(n) field to a varchar(n) field --- we don't let you do that
because the semantics aren't well defined. (One type thinks trailing
blanks are significant in a comparison, the other doesn't.)
As to what that something is, my guess is a foreign key constraint
that you didn't show us. IIRC, 7.0 fails to check for comparable
datatypes when you define a foreign key, so you get the error at
runtime instead :-(. Do you have another table that references this
one?
regards, tom lane
В списке pgsql-novice по дате отправления: