Thread: Error when creating table with boolean data type

Error when creating table with boolean data type

From
William Carithers
Date:
I get an "Error: relation "boolean" does not exist when attempting to create
a table with columns of data type boolean. I using PostgreSQL 8.3.6 and the
docs say that it supports boolean data type and even show some create table
examples similar to mine.

Sorry for such a newbie question but it's so simple that I'm stumped.

Here's the terminal session:
quasar=# create table flags (
 plate integer,
 mjd integer,
 fiber integer,
 redshift real,
 class varchar(20),
 core boolean,
 bonus boolean,
 midz boolean,
 lohiz boolean,
 neural boolean,
 ukidds boolean,
 kde boolean,
 like boolean,
 first boolean,
 umag real,
 gmag real,
 rmag real,
 imag real,
 zmag real,
 visual varchar(20));
ERROR:  relation "boolean" does not exist

Thanks.



Re: Error when creating table with boolean data type

From
William Carithers
Date:
OK, found it. I was trying to name a column with a keyword ('like'). The
error message threw me off. Sorry for the spam.

Bill


On 11/17/09 4:04 PM, "William Carithers" <wccarithers@lbl.gov> wrote:

> I get an "Error: relation "boolean" does not exist when attempting to create
> a table with columns of data type boolean. I using PostgreSQL 8.3.6 and the
> docs say that it supports boolean data type and even show some create table
> examples similar to mine.
>
> Sorry for such a newbie question but it's so simple that I'm stumped.
>
> Here's the terminal session:
> quasar=# create table flags (
>  plate integer,
>  mjd integer,
>  fiber integer,
>  redshift real,
>  class varchar(20),
>  core boolean,
>  bonus boolean,
>  midz boolean,
>  lohiz boolean,
>  neural boolean,
>  ukidds boolean,
>  kde boolean,
>  like boolean,
>  first boolean,
>  umag real,
>  gmag real,
>  rmag real,
>  imag real,
>  zmag real,
>  visual varchar(20));
> ERROR:  relation "boolean" does not exist
>
> Thanks.



Re: Error when creating table with boolean data type

From
APseudoUtopia
Date:
On Tue, Nov 17, 2009 at 7:15 PM, William Carithers <wccarithers@lbl.gov> wrote:
> On 11/17/09 4:04 PM, "William Carithers" <wccarithers@lbl.gov> wrote:
>
>> I get an "Error: relation "boolean" does not exist when attempting to create
>> a table with columns of data type boolean. I using PostgreSQL 8.3.6 and the
>> docs say that it supports boolean data type and even show some create table
>> examples similar to mine.
>>
>> Sorry for such a newbie question but it's so simple that I'm stumped.
>>
>> Here's the terminal session:
>> quasar=# create table flags (
>>  plate integer,
>>  mjd integer,
>>  fiber integer,
>>  redshift real,
>>  class varchar(20),
>>  core boolean,
>>  bonus boolean,
>>  midz boolean,
>>  lohiz boolean,
>>  neural boolean,
>>  ukidds boolean,
>>  kde boolean,
>>  like boolean,
>>  first boolean,
>>  umag real,
>>  gmag real,
>>  rmag real,
>>  imag real,
>>  zmag real,
>>  visual varchar(20));
>> ERROR:  relation "boolean" does not exist
>>
>> Thanks.
>
>
>
> OK, found it. I was trying to name a column with a keyword ('like'). The
> error message threw me off. Sorry for the spam.
>


I've done that before in the past. Since then, I've gotten into the
habit of putting double quotation marks around ALL table names. It
(hopefully) has prevented wasted time due to tracking down errors like
yours.

Re: Error when creating table with boolean data type

From
Tom Lane
Date:
William Carithers <wccarithers@lbl.gov> writes:
> OK, found it. I was trying to name a column with a keyword ('like'). The
> error message threw me off. Sorry for the spam.

FWIW, 8.4 and up will give you an error cursor on this:

ERROR:  relation "boolean" does not exist
LINE 14:  like boolean,
               ^

which doesn't directly say that "like" is the problem but might at least
help a little bit.

            regards, tom lane