Re: Argh! What's a 'bpchar'? (copy/serial issues...I think)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ken(at)kencorey(dot)com
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Argh! What's a 'bpchar'? (copy/serial issues...I think)
Date: 2001-01-19 02:27:08
Message-ID: 6312.979871228@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Ken Corey <ken(at)kencorey(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message rob 2001-01-19 04:32:27 Re: help
Previous Message Tom Lane 2001-01-19 02:08:38 Re: Re: Interval output format