-----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-----