Re: BUG #16212: subquery block allows to overwrite table aliasdefined earlier
От | David G. Johnston |
---|---|
Тема | Re: BUG #16212: subquery block allows to overwrite table aliasdefined earlier |
Дата | |
Msg-id | CAKFQuwbrretXNPdQdh99ZrahqDsaBh5Uk5U54r1MBigOxfu2fw@mail.gmail.com обсуждение исходный текст |
Ответ на | BUG #16212: subquery block allows to overwrite table alias defined earlier (PG Bug reporting form <noreply@postgresql.org>) |
Список | pgsql-bugs |
On Thu, Jan 16, 2020 at 3:37 PM PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:
Bug reference: 16212
Logged by: Denis Girko
Email address: luza.mbox@gmail.com
PostgreSQL version: 9.6.16
Operating system: Linux
Description:
These are just examples of poorly written queries where sub-query correlated value injection results in an arbitrary edge case: specifically, when a query can resolve a name as either a column or a table it chooses the column. Your choice of encoding your expected and actual output doesn't help you here as you are not distinguishing between a scalar column result and a composite table result being present.
select a from (values(1)) a; -- yields (1); the parens denote the result is a composite with a single field (whose name is "column1" since it was not given a name explicitly)
select a from (values(1)) a (a); -- yields 1; no parens denote the scalar result of 1 since the column named "a" exists and is preferred over the table named "a"
David J.
В списке pgsql-bugs по дате отправления: