pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Davis <pgsql@j-davis.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: pg_get_constraintdef() doesn't always give an equal constraint
Date: Mon, 30 Mar 2015 12:21:57 -0400
Message-ID: <17189.1427732517@sss.pgh.pa.us> (raw)
In-Reply-To: <1427694213.2845.20.camel@jeff-desktop>
References: <CAMp0ubcxvbnPevHz7LkTkRVDGvCgs+JTHCUn1pYMT-CK9cdJPg@mail.gmail.com>
	<19820.1427153553@sss.pgh.pa.us>
	<CAMp0ubfOPoQ-6QaiWg+S6nVuaQoB-M=m=1hV0V8NXOe+Q3XeBA@mail.gmail.com>
	<14244.1427569696@sss.pgh.pa.us>
	<1427694213.2845.20.camel@jeff-desktop>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Jeff Davis <pgsql@j-davis.com> writes:
> 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.

OK.  Given the lack of other suggestions, let's press forward with
fixing it this way.

> 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?

Meh.  The two switches are considering different things and don't have
exactly the same set of switch labels, so I don't really see that as
an improvement ...

> 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).

... especially since this change is outright wrong.  showtype == -1
implies that the caller is going to print a cast; we cannot insert a
COLLATE clause in the middle of that without breaking things.  (It may
be that this case is unreachable because a vanilla Const would never
have nondefault collation, but that doesn't make it a good change.)

>> 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.

Agreed, we'll fix HEAD only.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (14+ messages)  latest in thread

Message-ID: <17189.1427732517@sss.pgh.pa.us>
Permalink:  ../17189.1427732517@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17189.1427732517@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql@j-davis.com
  Subject: Re: pg_get_constraintdef() doesn't always give an equal constraint
  In-Reply-To: <17189.1427732517@sss.pgh.pa.us>
  References: <CAMp0ubcxvbnPevHz7LkTkRVDGvCgs+JTHCUn1pYMT-CK9cdJPg@mail.gmail.com> <19820.1427153553@sss.pgh.pa.us> <CAMp0ubfOPoQ-6QaiWg+S6nVuaQoB-M=m=1hV0V8NXOe+Q3XeBA@mail.gmail.com> <14244.1427569696@sss.pgh.pa.us> <1427694213.2845.20.camel@jeff-desktop> <17189.1427732517@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox