Re: Making the subquery alias optional in the FROM clause

Поиск
Список
Период
Сортировка
От Isaac Morland
Тема Re: Making the subquery alias optional in the FROM clause
Дата
Msg-id CAMsGm5e0voiCq=LQm4mMS2=ABbPn49NfaZRQCVECpQwufptm5w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Making the subquery alias optional in the FROM clause  (Julien Rouhaud <rjuju123@gmail.com>)
Список pgsql-hackers
On Tue, 28 Jun 2022 at 00:32, Julien Rouhaud <rjuju123@gmail.com> wrote:

> As to forcing SQL-complaint queries, that ship sailed a long time ago:
> Postgres allows but does not enforce the use of SQL-compliant queries, and
> many of its important features are extensions anyway, so forcing SQL
> compliant queries is out of the question (although I could see the utility
> of a mode where it warns or errors on non-compliant queries, at least in
> principle).

Sure, but it doesn't mean that we should support even more non-compliant syntax
without any restraint.  In this case, I don't see much benefit as it's not
solving performance problem or something like that.

It's improving developer performance by eliminating the need to make up utterly useless names. I don't care if behind the scenes names are assigned, although it would be even better if the names didn't exist at all. I just want the computer to do stuff for me that requires absolutely no human judgement whatsoever.

> As to bad habits, I'm having trouble understanding. Why do you think
> leaving the alias off a subquery is a bad habit (assuming it were allowed)?

I think It's a bad habit because as far as I can see it's not supported on
mysql or sqlserver.

So it’s a bad habit to use features of Postgres that aren’t available on MySQL or SQL Server?

For myself, I don’t care one bit about whether my code will run on those systems, or Oracle: as far as I’m concerned I write Postgres applications, not SQL applications. Of course, many people have a need to support other systems, so I appreciate the care we take to document the differences from the standard, and I hope we will continue to support standard queries. But if it’s a bad habit to use Postgres-specific features, why do we create any of those features?

> If the name is never used, why are we required to supply it?

But similarly, I many times relied on the fact that writable CTE are executed
even if not explicitly referenced.  So by the same argument shouldn't we allow
something like this?

WITH (INSERT INTO t SELECT * pending WHERE ts < now())
SELECT now() AS last_processing_time;

I’m not necessarily opposed to allowing this too. But the part which causes me annoyance is normal subquery naming.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Isaac Morland
Дата:
Сообщение: Re: Separate the attribute physical order from logical order
Следующее
От: John Naylor
Дата:
Сообщение: Re: [PoC] Improve dead tuple storage for lazy vacuum