Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1espvn-0005JD-K6 for pgsql-general@arkaria.postgresql.org; Mon, 05 Mar 2018 13:13:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1espvl-0007d8-WE for pgsql-general@arkaria.postgresql.org; Mon, 05 Mar 2018 13:13:30 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1espvl-0007cz-91 for pgsql-general@lists.postgresql.org; Mon, 05 Mar 2018 13:13:29 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1espvd-0000Lc-0v for pgsql-general@lists.postgresql.org; Mon, 05 Mar 2018 13:13:27 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 7BBB021C1CD7 for ; Mon, 5 Mar 2018 16:13:17 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.41] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 5434321C1CD5 for ; Mon, 5 Mar 2018 16:13:17 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1520255597; bh=BtR9K6Im3+IF+9cWGQPhF/oUAq7Aoa8cC3TEIC9rSbE=; h=To:From:Subject:Date; b=IIlqW5o20E1ZEmSUCyz5y8oc+v6EoT/4LWjLjr+ZnhMGYB3HgYRK243JqgaJS81Ss QbhdtbLeb6uwg6cPL8QQ3/uOVk3+x5PqIV9lEI0XtxL8+pK++qcVu4hWbKp6oyb8Qd 4l8hgrCZ9AwdA4b5y0iKjUMf5UBsc1r9jnBCpal8= To: pgsql-general@lists.postgresql.org From: Pavel Luzanov Subject: psql variables in the DO command Message-ID: <5bae153c-ade4-ad24-bd46-857993240cfd@postgrespro.ru> Date: Mon, 5 Mar 2018 16:13:16 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru-RU List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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;$$;                                      ^ -- ----- Pavel Luzanov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company