Re: apostrophes and psql variables

From: Q Beukes <pgsql-general(at)list(dot)za(dot)net>
To: ilejn(at)yandex(dot)ru, pgsql-general-postgresql(dot)org(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: apostrophes and psql variables
Date: 2006-08-20 20:39:28
Message-ID: 44E8C880.20608@list.za.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You must have missed one, because:

root=# \set tv1 '\'testval\''
root=# insert into test values(:tv1);
INSERT 0 1
root=#

Ilja Golshtein wrote:
> Hello!
>
> Is there any way to have psql variable in apostrophes?
>
> The idea is to do something like this
>
> \set var 'some value'
> insert into aaa values(:var)
>
> after substisution it should as simple as
> insert into aaa values('some value')
>
> I've tried all reasonable quotings
> I was able to make up but no any luck.
>
> Thanks.
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iQEVAwUBROjIerEDZDQ16UzTAQIVLAf/WFZVTRyc9s4tTh1BDel1OOOmJgak2ebJ
wYynHWxh2lrudyROybLS3Btbs98jnRsWZC7yNXCugkfDjZ7+n/paPFXcyCZIFqEr
akfHZXfRtkphD8IFrFCCsMIn68bU39CY+f/JtvyO1uIeSylolFDSfjOEh8jdPD6e
NciBURYj+q51Ugna63ym55zKmgSzISqdiDKzArtsfs7hYpzPo+8A4r/Ig7J6GsI9
3DON02eNaryYKdAdSJsnJWzLmhsgfp9oNI0X3V/fIcBV5w1SKgp/BsPYb/D7KbMI
XRmCglWQq8K4QzWjdaptLHbfuwmjRUuNMvzGs33VSZrjJywqqFcVcQ==
=yf0V
-----END PGP SIGNATURE-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Gunther 2006-08-20 23:49:25 Re: Locale, encoding, sort order confusion
Previous Message Jim 2006-08-20 19:50:10 service postgresql start : failed