Re: psql variables in the DO command

2018-03-06 Thread Pavel Stehule
2018-03-06 10:17 GMT+01:00 Pavel Luzanov : > On 05.03.2018 18:35, Pavel Stehule wrote: > > I am slowly working on prototype. The work is simple, when variables are > just scalars. But it is much harder, when we allow composite variables. > When prototype will be done, I invite any cooperation - th

Re: psql variables in the DO command

2018-03-06 Thread Pavel Luzanov
On 05.03.2018 18:35, Pavel Stehule wrote: I am slowly working on prototype. The work is simple, when variables are just scalars. But it is much harder, when we allow composite variables. When prototype will be done, I invite any cooperation - there are lot of question - and one very hard - wher

Re: psql variables in the DO command

2018-03-05 Thread Pavel Stehule
2018-03-05 16:19 GMT+01:00 Pavel Luzanov : > On 05.03.2018 18:01, Pavel Stehule wrote: > > > It is most correct when you thinking about it. > > 1. :xx is out of SQL syntax, so can by safely used. There is not risk of > unwanted usage. > > But there is absence of wanted usage too. > How much stron

Re: psql variables in the DO command

2018-03-05 Thread Pavel Luzanov
On 05.03.2018 18:01, Pavel Stehule wrote: It is most correct when you thinking about it. 1. :xx is out of SQL syntax, so can by safely used. There is not risk of unwanted usage. But there is absence of wanted usage too. 2. but string literal can contain :xxx symbols and not necessary it me

Re: psql variables in the DO command

2018-03-05 Thread Pavel Stehule
2018-03-05 15:02 GMT+01:00 Pavel Luzanov : > On 05.03.2018 16:56, Pavel Stehule wrote: > > >> I can't use psql variable in the DO command. Is it intentional behavior? >>> >> >> yes. psql variables living on client side, and are not accessible from >> server side . DO command is executed on server

Re: psql variables in the DO command

2018-03-05 Thread Pavel Luzanov
Another possible, but inconvenient workaround - constructing the right string before execution: postgres=# \set var 'Hello, World!' postgres=# \set cmd '$$begin raise notice ''%'', ' :'var' '; end;$$;' postgres=# do :cmd; NOTICE:  Hello, World! DO - Pavel Luzanov Postgres Professional: http

Re: psql variables in the DO command

2018-03-05 Thread Pavel Luzanov
On 05.03.2018 16:56, Pavel Stehule wrote: I can't use psql variable in the DO command. Is it intentional behavior? yes. psql variables living on client side, and are not accessible from server side . DO command is executed on server side. But SELECT command also

Re: psql variables in the DO command

2018-03-05 Thread Pavel Stehule
2018-03-05 14:52 GMT+01:00 Pavel Luzanov : > On 05.03.2018 16:42, Pavel Stehule wrote: > > > I can't use psql variable in the DO command. Is it intentional behavior? >> > > yes. psql variables living on client side, and are not accessible from > server side . DO command is executed on server side.

Re: psql variables in the DO command

2018-03-05 Thread Pavel Luzanov
On 05.03.2018 16:42, Pavel Stehule wrote: I can't use psql variable in the DO command. Is it intentional behavior? yes. psql variables living on client side, and are not accessible from server side . DO command is executed on server side. But SELECT command also executed on a server

Re: psql variables in the DO command

2018-03-05 Thread Pavel Stehule
Hi 2018-03-05 14:13 GMT+01:00 Pavel Luzanov : > Hello, > > I can't use psql variable in the DO command. Is it intentional behavior? > yes. psql variables living on client side, and are not accessible from server side . DO command is executed on server side. you can copy psql variables to GUC va

psql variables in the DO command

2018-03-05 Thread Pavel Luzanov
Hello, I can't use psql variable in the DO command. Is it intentional behavior? postgres=# \set var 'Hello, World!' postgres=# do $$begin raise notice '%', :'var'; end;$$; ERROR:  syntax error at or near ":" LINE 1: do $$begin raise notice '%', :'var'; end;$$;