Обсуждение: column does not exist error

Поиск
Список
Период
Сортировка

column does not exist error

От
Dave Coventry
Дата:
Tearing my hair out, can anyone see what I'm doing wrong?

  SELECT title FROM node WHERE type=client;

ERROR:  column "client" does not exist
LINE 1: SELECT title FROM node WHERE type=client;

Yet this works:

 SELECT type FROM node;
  type
--------
 client
 client
 client
 client
 client
(5 rows)

Re: column does not exist error

От
Raymond O'Donnell
Дата:
On 18/11/2009 13:23, Dave Coventry wrote:
> Tearing my hair out, can anyone see what I'm doing wrong?
>
>   SELECT title FROM node WHERE type=client;

You need to quote literal values:

   SELECT title FROM node WHERE type='client';

Otherwise PG thinks you're referring to a column called "client", as you
saw.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

Re: column does not exist error

От
"Naoko Reeves"
Дата:
SELECT title FROM node WHERE type='client'; Would this work?

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Dave Coventry
Sent: Wednesday, November 18, 2009 6:24 AM
To: pgsql-general General
Subject: [GENERAL] column does not exist error

Tearing my hair out, can anyone see what I'm doing wrong?

  SELECT title FROM node WHERE type=client;

ERROR:  column "client" does not exist
LINE 1: SELECT title FROM node WHERE type=client;

Yet this works:

 SELECT type FROM node;
  type
--------
 client
 client
 client
 client
 client
(5 rows)

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: column does not exist error

От
Thomas Kellerer
Дата:
Dave Coventry, 18.11.2009 14:23:
> Tearing my hair out, can anyone see what I'm doing wrong?
>
>   SELECT title FROM node WHERE type=client;
>
> ERROR:  column "client" does not exist
> LINE 1: SELECT title FROM node WHERE type=client;
>

You are missing the quotes to identify a character literal:

SELECT title FROM node WHERE type='client';

Thomas

Re: column does not exist error

От
Vidhya Bondre
Дата:
Can you try reframing it as :
 
SELECT title FROM node WHERE type='client;
 
Regards
Vidhya


 
On Wed, Nov 18, 2009 at 6:53 PM, Dave Coventry <dgcoventry@gmail.com> wrote:
Tearing my hair out, can anyone see what I'm doing wrong?

 SELECT title FROM node WHERE type=client;

ERROR:  column "client" does not exist
LINE 1: SELECT title FROM node WHERE type=client;

Yet this works:

 SELECT type FROM node;
 type
--------
 client
 client
 client
 client
 client
(5 rows)

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: column does not exist error

От
Thomas Markus
Дата:
Hi,

try

SELECT title FROM node WHERE type='client';


hth
Thomas


Dave Coventry schrieb:
> Tearing my hair out, can anyone see what I'm doing wrong?
>
>   SELECT title FROM node WHERE type=client;
>
> ERROR:  column "client" does not exist
> LINE 1: SELECT title FROM node WHERE type=client;
>
> Yet this works:
>
>  SELECT type FROM node;
>   type
> --------
>  client
>  client
>  client
>  client
>  client
> (5 rows)
>
>


Re: column does not exist error

От
Scott Marlowe
Дата:
Type may be a reserved keyword and need double quoting:

where "type"='client';

On Wed, Nov 18, 2009 at 6:23 AM, Dave Coventry <dgcoventry@gmail.com> wrote:
> Tearing my hair out, can anyone see what I'm doing wrong?
>
>  SELECT title FROM node WHERE type=client;
>
> ERROR:  column "client" does not exist
> LINE 1: SELECT title FROM node WHERE type=client;
>
> Yet this works:
>
>  SELECT type FROM node;
>  type
> --------
>  client
>  client
>  client
>  client
>  client
> (5 rows)
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>



--
When fascism comes to America, it will be intolerance sold as diversity.