Error: column "host" does not exist

Started by Mayuresh Nirhaliover 17 years ago6 messagesgeneral
Jump to latest
#1Mayuresh Nirhali
Mayuresh.Nirhali@Sun.COM

Hello,

I am working with 8.1.4 pgsql as my database backend. I have a function
written in plpgsql language, that queries a particular table as below,

select host from table_host where ip_address = ip_array[i] and port =
port_array[i];

The query is running in a for loop. I see ip_array and port_array
getting populated with correct values during the execution.
The error I see is,

ERROR: column "host" does not exist
CONTEXT: SQL statement "SELECT host"
PL/pgSQL function "sp_get_ip_data" line 286 at raise

throu psql, I can select the table_host fine.
column "host" is a primary key here.

I dont understand why I see the "column does not exist" error; any idea ?

cheers
Mayuresh

#2Reg Me Please
regmeplease@gmail.com
In reply to: Mayuresh Nirhali (#1)
Re: Error: column "host" does not exist

IS there any name clash with a function argument?

--
Fahrbahn ist ein graues Band
weisse Streifen, grüner Rand

Show quoted text

On Thursday 08 January 2009 08:30:07 Mayuresh Nirhali wrote:

Hello,

I am working with 8.1.4 pgsql as my database backend. I have a function
written in plpgsql language, that queries a particular table as below,

select host from table_host where ip_address = ip_array[i] and port =
port_array[i];

The query is running in a for loop. I see ip_array and port_array
getting populated with correct values during the execution.
The error I see is,

ERROR: column "host" does not exist
CONTEXT: SQL statement "SELECT host"
PL/pgSQL function "sp_get_ip_data" line 286 at raise

throu psql, I can select the table_host fine.
column "host" is a primary key here.

I dont understand why I see the "column does not exist" error; any idea ?

cheers
Mayuresh

#3A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Mayuresh Nirhali (#1)
Re: Error: column "host" does not exist

In response to Mayuresh Nirhali :

Hello,

I am working with 8.1.4 pgsql as my database backend. I have a function
written in plpgsql language, that queries a particular table as below,

select host from table_host where ip_address = ip_array[i] and port =
port_array[i];

The query is running in a for loop. I see ip_array and port_array
getting populated with correct values during the execution.
The error I see is,

ERROR: column "host" does not exist
CONTEXT: SQL statement "SELECT host"
PL/pgSQL function "sp_get_ip_data" line 286 at raise

throu psql, I can select the table_host fine.
column "host" is a primary key here.

Not sure, but host is a reserved word, see:
http://www.postgresql.org/docs/8.1/interactive/sql-keywords-appendix.html

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

#4Mayuresh Nirhali
Mayuresh.Nirhali@Sun.COM
In reply to: Reg Me Please (#2)
Re: Error: column "host" does not exist

No. there are no name clashes.

I actually changed the names in posted text a bit. The arguments,
declared variables and column names, all have their unique prefixes.

Thanks
Mayuresh

Reg Me Please wrote:

Show quoted text

IS there any name clash with a function argument?

--
Fahrbahn ist ein graues Band
weisse Streifen, gr�ner Rand

On Thursday 08 January 2009 08:30:07 Mayuresh Nirhali wrote:

Hello,

I am working with 8.1.4 pgsql as my database backend. I have a function
written in plpgsql language, that queries a particular table as below,

select host from table_host where ip_address = ip_array[i] and port =
port_array[i];

The query is running in a for loop. I see ip_array and port_array
getting populated with correct values during the execution.
The error I see is,

ERROR: column "host" does not exist
CONTEXT: SQL statement "SELECT host"
PL/pgSQL function "sp_get_ip_data" line 286 at raise

throu psql, I can select the table_host fine.
column "host" is a primary key here.

I dont understand why I see the "column does not exist" error; any idea ?

cheers
Mayuresh

#5Reg Me Please
regmeplease@gmail.com
In reply to: Mayuresh Nirhali (#4)
Re: Error: column "host" does not exist

Please post is possible the code (DDL and function).
Otherwise it'd be much more difficult.
And if you change the names, please check whether the error is still there.

--
Fahrbahn ist ein graues Band
weisse Streifen, grüner Rand

Show quoted text

On Thursday 08 January 2009 09:15:05 Mayuresh Nirhali wrote:

No. there are no name clashes.

I actually changed the names in posted text a bit. The arguments,
declared variables and column names, all have their unique prefixes.

Thanks
Mayuresh

Reg Me Please wrote:

IS there any name clash with a function argument?

--
Fahrbahn ist ein graues Band
weisse Streifen, grüner Rand

On Thursday 08 January 2009 08:30:07 Mayuresh Nirhali wrote:

Hello,

I am working with 8.1.4 pgsql as my database backend. I have a function
written in plpgsql language, that queries a particular table as below,

select host from table_host where ip_address = ip_array[i] and port =
port_array[i];

The query is running in a for loop. I see ip_array and port_array
getting populated with correct values during the execution.
The error I see is,

ERROR: column "host" does not exist
CONTEXT: SQL statement "SELECT host"
PL/pgSQL function "sp_get_ip_data" line 286 at raise

throu psql, I can select the table_host fine.
column "host" is a primary key here.

I dont understand why I see the "column does not exist" error; any idea
?

cheers
Mayuresh

#6Peter Eisentraut
peter_e@gmx.net
In reply to: A. Kretschmer (#3)
Re: Error: column "host" does not exist

A. Kretschmer wrote:

Not sure, but host is a reserved word, see:
http://www.postgresql.org/docs/8.1/interactive/sql-keywords-appendix.html

That list says that HOST is reserved in SQL:1999, but not in PostgreSQL.