Re: Schema variables - new implementation for Postgres 15

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Erik Rijkers <er(at)xs4all(dot)nl>
Cc: Julien Rouhaud <rjuju123(at)gmail(dot)com>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Joel Jacobson <joel(at)compiler(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Schema variables - new implementation for Postgres 15
Date: 2022-08-31 04:23:38
Message-ID: CAFj8pRCLqQa6z2nqfPwUZJCc3zcHBanzZmDt8y0pOFLs3_9oGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

st 24. 8. 2022 v 10:04 odesílatel Erik Rijkers <er(at)xs4all(dot)nl> napsal:

> Op 24-08-2022 om 08:37 schreef Pavel Stehule:
> >>
> >
> > I fixed these.
> >
>
> > [v20220824-1-*.patch]
>
> Hi Pavel,
>
> I noticed just now that variable assignment (i.e., LET) unexpectedly
> (for me anyway) cast the type of the input value. Surely that's wrong?
> The documentation says clearly enough:
>
> 'The result must be of the same data type as the session variable.'
>
>
> Example:
>
> create variable x integer;
> let x=1.5;
> select x, pg_typeof(x);
> x | pg_typeof
> ---+-----------
> 2 | integer
> (1 row)
>
>
> Is this correct?
>
> If such casts (there are several) are intended then the text of the
> documentation should be changed.
>

I changed this

@@ -58,8 +58,9 @@ LET <replaceable
class="parameter">session_variable</replaceable> = DEFAULT
<term><literal>sql_expression</literal></term>
<listitem>
<para>
- An SQL expression, in parentheses. The result must be of the same
data type as the session
- variable.
+ An SQL expression (can be subquery in parenthesis). The result must
+ be of castable to the same data type as the session variable (in
+ implicit or assignment context).
</para>
</listitem>
</varlistentry>

is it ok?

Regards

Pavel

> Thanks,
>
> Erik
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2022-08-31 04:37:20 Re: New strategies for freezing, advancing relfrozenxid early
Previous Message Nathan Bossart 2022-08-31 04:17:12 Re: [PATCH] Optimize json_lex_string by batching character copying