Behavior of parameter holders in query containing a '$1'

From: Eddy Hahn <EDDYH(at)CREIGHTONEDWARD(dot)COM>
To: pgsql-general(at)postgresql(dot)org
Subject: Behavior of parameter holders in query containing a '$1'
Date: 2010-09-28 20:29:53
Message-ID: 11BF774F-C6D5-40E7-9421-C54F047A1D4C@CREIGHTONEDWARD.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

1) I'm reading the API documentation and I'm wondering how the client library would handle the following statement

INSERT INTO test (value1, value2) VALUES ('$1', $1)

Would it handle it incorrectly and would think that '$1' is the parameter or would it skip it because it know that it's a string value encapsulated in ''?

2) Can $1 be used more then one times for example if you want to use the same value for multiple column value?
UPDATE test set value1=$1,value2=$1

Thanks,

Eddy

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2010-09-28 20:38:57 Re: pg_upgrade
Previous Message Brian Hirt 2010-09-28 20:27:21 Re: pg_upgrade