Thread: column doesnt exist?

column doesnt exist?

From
Cao Duy
Date:
hi,

I created this table:
CREATE TABLE public.stresslog(
  "AbfrageId" int8 NOT NULL DEFAULT
nextval('public."stresslog_AbfrageId_seq"'::text),
  "AbfrageTyp" varchar(50) NOT NULL,
  "Abfrage" varchar(300),
  "AnzZeilen" int8 DEFAULT 0,
  "ZeitVerbrauch" int8 DEFAULT 0,
  "AnzCon" int4 DEFAULT 0,
  "AnzSchreib" int4 DEFAULT 0,
  "AnzLesen" int4 DEFAULT 0,
  "AnzTabDs" int8 DEFAULT 0,
  "TabName" varchar(100),
  "AnzAnweisungen" int4 DEFAULT 1,
  "SystemMeldung" varchar(100) DEFAULT 'OK'::character varying,
  "AusfuehrungsZeit" date,
  CONSTRAINT stresslog_pkey PRIMARY KEY ("AbfrageId")
) WITHOUT OIDS;

I try to execute the following statement and get this err.msg:
select AbfrageTyp from stresslog
->ERROR: Column abfragetyp doesn't exist

the same err.msg occurs to all other field ... that mean query like
"select TabName,Anzcon from stresslog" doesn't work.

I try SELECT * FROM STRESSLOG, that works fine.
what's wrong? It is a (known) bug?


please help


best regards


ps: enviroments: pgSQL 7.4.3 on SunOS

Re: column doesnt exist?

From
Stephan Szabo
Date:
On Thu, 18 Nov 2004, Cao Duy wrote:

> hi,
>
> I created this table:
> CREATE TABLE public.stresslog(
>   "AbfrageId" int8 NOT NULL DEFAULT
> nextval('public."stresslog_AbfrageId_seq"'::text),
>   "AbfrageTyp" varchar(50) NOT NULL,
>   "Abfrage" varchar(300),
>   "AnzZeilen" int8 DEFAULT 0,
>   "ZeitVerbrauch" int8 DEFAULT 0,
>   "AnzCon" int4 DEFAULT 0,
>   "AnzSchreib" int4 DEFAULT 0,
>   "AnzLesen" int4 DEFAULT 0,
>   "AnzTabDs" int8 DEFAULT 0,
>   "TabName" varchar(100),
>   "AnzAnweisungen" int4 DEFAULT 1,
>   "SystemMeldung" varchar(100) DEFAULT 'OK'::character varying,
>   "AusfuehrungsZeit" date,
>   CONSTRAINT stresslog_pkey PRIMARY KEY ("AbfrageId")
> ) WITHOUT OIDS;
>
> I try to execute the following statement and get this err.msg:
> select AbfrageTyp from stresslog

Unquoted column names are casefolded (in PostgreSQL to lowercase, in
standard SQL to uppercase).  You need to say select "AbfrageTyp" from
stresslog if you create the table with double quoted column names.

Re: column doesnt exist?

From
Achilleus Mantzios
Date:
O Cao Duy Ýãñáøå óôéò Nov 18, 2004 :

> hi,
>
> I created this table:
> CREATE TABLE public.stresslog(
>   "AbfrageId" int8 NOT NULL DEFAULT
> nextval('public."stresslog_AbfrageId_seq"'::text),
>   "AbfrageTyp" varchar(50) NOT NULL,
>   "Abfrage" varchar(300),
>   "AnzZeilen" int8 DEFAULT 0,
>   "ZeitVerbrauch" int8 DEFAULT 0,
>   "AnzCon" int4 DEFAULT 0,
>   "AnzSchreib" int4 DEFAULT 0,
>   "AnzLesen" int4 DEFAULT 0,
>   "AnzTabDs" int8 DEFAULT 0,
>   "TabName" varchar(100),
>   "AnzAnweisungen" int4 DEFAULT 1,
>   "SystemMeldung" varchar(100) DEFAULT 'OK'::character varying,
>   "AusfuehrungsZeit" date,
>   CONSTRAINT stresslog_pkey PRIMARY KEY ("AbfrageId")
> ) WITHOUT OIDS;
>
> I try to execute the following statement and get this err.msg:
> select AbfrageTyp from stresslog
> ->ERROR: Column abfragetyp doesn't exist

Since you prefer case sensitive col names, try

 select "AbfrageTyp" from stresslog

>
> the same err.msg occurs to all other field ... that mean query like
> "select TabName,Anzcon from stresslog" doesn't work.
>
> I try SELECT * FROM STRESSLOG, that works fine.
> what's wrong? It is a (known) bug?
>
>
> please help
>
>
> best regards
>
>
> ps: enviroments: pgSQL 7.4.3 on SunOS
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>

--
-Achilleus

Re: column doesnt exist?

From
Michael Fuhr
Date:
On Thu, Nov 18, 2004 at 03:47:16PM +0100, Cao Duy wrote:

>   "AbfrageTyp" varchar(50) NOT NULL,

[snip]

> select AbfrageTyp from stresslog
> ->ERROR: Column abfragetyp doesn't exist

Read the "Identifiers and Key Words" section of the "SQL Syntax"
chapter in the documentation, especially the parts about quoted
identifiers.

http://www.postgresql.org/docs/7.4/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/