Re: pg_get_constraintdef() doesn't always give an equal constraint

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: pg_get_constraintdef() doesn't always give an equal constraint
Дата
Msg-id 1427694213.2845.20.camel@jeff-desktop
обсуждение исходный текст
Ответ на Re: pg_get_constraintdef() doesn't always give an equal constraint  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pg_get_constraintdef() doesn't always give an equal constraint  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Sat, 2015-03-28 at 15:08 -0400, Tom Lane wrote:
> Basically, I think we have to change ruleutils so that it quotes anything
> that wouldn't be seen as a simple integer or numeric constant by the
> lexer+grammar.
>
> The attached patch does this; the regression test changes illustrate
> what's going to happen to the output if we do this.

This fixes my problem, thank you.

There are two switch statements in that function, and they have
overlapping purposes. Can't we just always set needlabel in the first
switch statement, and remove the second switch statement?

When I refactored it to do that (attached), I noticed that if showtype
== -1, it returns before appending the collation. I don't see any reason
those should be related, so I removed the early return (I don't think
there's an actual bug there, though).

There are more diffs in the contrib tests, also included in my version.

> Looking at the changes, I'm not 100% convinced we want to back-patch.
> As you say, nobody's complained of this problem before, and I'm worried
> that people will see the output changes as a bigger deal than the issue
> we're trying to fix.

Fine with me.

Regards,
    Jeff Davis


Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg_get_constraintdef() doesn't always give an equal constraint
Следующее
От: chjischj@163.com
Дата:
Сообщение: BUG #12917: C program created by ecpg core dumped due to “varcharsize * offset”