pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ross J. Reedstrom <reedstrm@wallace.ece.rice.edu>
To: Ruben Fagundo <rfagundo@npv.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Fwd: Re: fun with postgresql
Date: Fri, 28 Jan 2000 12:01:56 -0600
Message-ID: <20000128120156.E11642@rice.edu> (raw)
In-Reply-To: <4.1.20000128113419.00abd970@24.128.29.181>
References: <4.1.20000128113419.00abd970@24.128.29.181>

On Fri, Jan 28, 2000 at 11:38:49AM -0500, Ruben Fagundo wrote:
> Does anyone have any idea why this happened ?
> 
> I'm having trouble with postgresql.  My script tries to do this:
> 
> my $sql = "insert into people (firstName, lastName, Email)
> values ($V{'firstname'}, $V{'lastname'}, $V{'MAILTO'})";
> 
> but it gets the error:  DBD::Pg::st execute failed: ERROR: Attribute don not
> found .  'don' is the firstName value that I'm trying to insert.  Even in
> psql I get similar weirdness:
> 
> postgres=> select firstName, lastName, Email from people \g
> ERROR:  attribute 'firstname' not found
> postgres=> select firstName from people \g
> ERROR:  attribute 'firstname' not found
> postgres=> select Email from people \g
> ERROR:  attribute 'email' not found


To make this work, try:

select "firstName", "lastName", "Email" from people ;

> 
> But 'select * from people' works.
> 
> What am I missing?  Is there a case-sensitivity issue?  I'm using the case
> for the field names that I see with a '\d people'


Right, it's the SQL quoting rules. A bare name is taken to mean an
identifier (table name or field name), which is then downcased before
lookup. Quoting with double quotes (") indicates an identifier that is
used directly, without downcasing (or validation against reserved words:
you can make very odd tablenames that way). All string values need to be
quoted with single quotes (')

idas=> select test;
ERROR:  attribute 'test' not found
idas=> select 'test';
?column?
--------
test    
(1 row)

idas=> 

I don't know perl, but you need to get the single quotes around all the 
values.

Hope this helps,

Ross

P.S. This question probably belongs on the interfaces list, not admin.
-- 
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005




view thread (4+ messages)  latest in thread

Message-ID: <20000128120156.E11642@rice.edu>
Permalink:  ../20000128120156.E11642@rice.edu/
Also on:    postgresql.org/message-id/20000128120156.E11642@rice.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: reedstrm@wallace.ece.rice.edu, rfagundo@npv.com
  Subject: Re: [ADMIN] Fwd: Re: fun with postgresql
  In-Reply-To: <20000128120156.E11642@rice.edu>
  References: <4.1.20000128113419.00abd970@24.128.29.181> <20000128120156.E11642@rice.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox