pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Randall Perry <rgp@systame.com>
To: pgsql-general@postgresql.org
To: pgsql-interfaces@postgresql.org
Subject: Re: Var substitution in SELECT statements
Date: Mon, 23 Apr 2001 21:41:51 -0400
Message-ID: <B70A521F.A291%rgp@systame.com> (raw)
In-Reply-To: <B70A4D23.A28D%rgp@systame.com>

on 4/23/01 9:20 PM, Randall Perry at rgp@systame.com wrote:

> This works:
> $res  = $conn->exec("select cust, contact, user_name, email from $t where
> user_name = a1a");
> 
> This doesn't:
> $c = "a1a";
> $res  = $conn->exec("select cust, contact, user_name, email from $t where
> user_name = $c");
> 
> and returns the error:
> Attribute 'a1a' not found
> 
> 
> How do you do var substitution with the Pg module in Perl?

Whoops! Needed to quote the var as so (for $c above):

$c = "\'$c\'";

Works now.

-- 
Randy Perry
sysTame
Mac Consulting/Sales




view thread (4+ messages)  latest in thread

Message-ID: <B70A521F.A291%rgp@systame.com>
Permalink:  ../B70A521F.A291%25rgp@systame.com/
Also on:    postgresql.org/message-id/B70A521F.A291%rgp@systame.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: rgp@systame.com, pgsql-general@postgresql.org
  Subject: Re: Var substitution in SELECT statements
  In-Reply-To: <B70A521F.A291%rgp@systame.com>

* 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