Re: pretty_bool in pg_get_constraintdef has no effect since pg >= 9

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: eli(dot)mach(at)mailbox(dot)org
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: pretty_bool in pg_get_constraintdef has no effect since pg >= 9
Date: 2020-02-25 13:30:17
Message-ID: 15619FB4-5F5A-4A71-B945-78C3FB82FAED@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On 25 Feb 2020, at 13:56, eli(dot)mach(at)mailbox(dot)org wrote:

> since postgres 9, `pg_get_constraintdef(cons.oid, pretty_bool)` does not work as expected. The result is always in "pretty"-format (with newlines), regardless of whether `pretty_bool` is true or false. Calling `pg_get_constraintdef(constraint_oid)` without `pretty_bool`, also returns "pretty"-format.

This is not a bug, but a deliberate change which was made in 62e666400d back in
2013, the argument being that changes in whitespace should not affect forward
compatibility.

> I'm migrating from postgres 8 to 11 and a sqlalchemy script throws a warning "SAWarning: Could not parse CHECK constraint text" because there a no newlines expected in `re.match(r"^CHECK *\((.+)\)( NOT VALID)?$", src)`.

Surely SA has been updated to work with more recent version of postgres? I've
not used SA myself, but are you sure you are using the right version of the
tool?

cheers ./daniel

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message eli.mach 2020-02-25 13:59:27 Re: pretty_bool in pg_get_constraintdef has no effect since pg >= 9
Previous Message eli.mach 2020-02-25 12:56:22 pretty_bool in pg_get_constraintdef has no effect since pg >= 9