Re: Variable substitution in psql backtick expansion

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Fabien COELHO" <coelho(at)cri(dot)ensmp(dot)fr>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>,"PostgreSQL Developers" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Variable substitution in psql backtick expansion
Date: 2017-04-03 20:26:24
Message-ID: 9c134d0f-65a7-4dc9-a54b-5b3ea9faf51e@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Fabien COELHO wrote:

> Now it could be decided that \set in psql stays simplistic because it is
> not needed as much as it is with pgbench. Fine with me.

It's not just that. It's that currently, if we do in psql:

\set d sqrt(1 + random(1000) * 17)

then we get that:

\echo :d
sqrt(1+random(1000)*17)

I assume we want to keep that pre-existing behavior of \set in
psql, that is, making a copy of that string and associating a
name to it, whereas I guess pgbench computes a value from it and
stores that value.

Certainly if we want the same sort of evaluator in pgbench and psql
we'd better share the code between them, but I don't think it will be
exposed by the same backslash commands in both programs,
if only for that backward compatibility concern.

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2017-04-03 20:27:42 Re: identity columns
Previous Message Thomas Munro 2017-04-03 20:25:06 Re: SERIALIZABLE with parallel query