Re: execute prepared statement passing parameter expression with COLLATE clause

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: execute prepared statement passing parameter expression with COLLATE clause
Date: 2024-10-24 14:34:07
Message-ID: 2458353.1729780447@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

jian he <jian(dot)universality(at)gmail(dot)com> writes:
> select * from pktable where x = 'Å' collate ignore_accents;
> --return one row

> execute q6('Å' collate ignore_accents);
> --return zero rows

> not sure return zero rows is desired.

The parameter symbol just represents a value, which does not
carry any collation information. The collation to use was
determined when the prepared statement was parsed, and is not
going to change on the basis of what you write in EXECUTE.
We could have a discussion about whether this is desirable,
but it's prett much moot, because this is how the SQL committee
designed SQL's collation feature. It's not going to change.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2024-10-24 14:55:22 Re: Fix for consume_xids advancing XIDs incorrectly
Previous Message Junwang Zhao 2024-10-24 14:33:00 Re: general purpose array_sort