Re: pgindent && weirdness

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: pgindent && weirdness
Дата
Msg-id 20200217153525.GA14354@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: pgindent && weirdness  (Thomas Munro <thomas.munro@gmail.com>)
Ответы Re: pgindent && weirdness
Список pgsql-hackers
On 2020-Feb-17, Thomas Munro wrote:

> Thinking about this again: It's obviously not true that everything
> that looks like a function call is not a cast.  You could have
> "my_cast(Type)" that expands to "(Type)" or some slightly more useful
> variant of that, and then "my_cast(Type) -1" would, with this patch
> applied, be reformatted as "my_cast(Type) - 1" because it'd err on the
> side of thinking that the expression produces a value and therefore
> the minus sign must be a binary operator that needs whitespace on both
> sides, and that'd be wrong.  However, it seems to me that macros that
> expand to raw cast syntax (and I mean just "(Type)", not a complete
> cast including the value to be cast, like "((Type) (x))") must be rare
> and unusual things, and I think it's better to err on the side of
> thinking that function-like macros are values, not casts.  That's all
> the change does, and fortunately the authors of indent showed how to
> do that with their existing special cases for offsetof and sizeof; I'm
> just extending that treatment to any identifier.

Hmm ... this suggests to me that if you remove these alleged special
cases for offsetof and sizeof, the new code handles them correctly
anyway.  Do you think it's worth giving that a try?  Not because
removing the special cases would have any value, but rather to see if
anything interesting pops up.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Optimize update of tables with generated columns
Следующее
От: Muhammad Usama
Дата:
Сообщение: Re: [HACKERS] Transactions involving multiple postgres foreignservers, take 2