pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: eli.mach@mailbox.org
To: Daniel Gustafsson <daniel@yesql.se>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: pretty_bool in pg_get_constraintdef has no effect since pg >= 9
Date: Tue, 25 Feb 2020 14:59:27 +0100 (CET)
Message-ID: <248997790.14326.1582639167881@office.mailbox.org> (raw)
In-Reply-To: <15619FB4-5F5A-4A71-B945-78C3FB82FAED@yesql.se>
References: <490036036.13996.1582635382921@office.mailbox.org>
	<15619FB4-5F5A-4A71-B945-78C3FB82FAED@yesql.se>

The SA-Version I use is the newest version 1.3.13. Seems that the SA regex never had to deal with newlines. I think that can be easily fixed by adding a "re.DOTALL" in the SA regex. I open an SA-Issue. Thanks for your help.

Greetings,
elim.

> On 25 February 2020 14:30 Daniel Gustafsson <daniel@yesql.se> wrote:
> 
>  
> > On 25 Feb 2020, at 13:56, eli.mach@mailbox.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





view thread (3+ messages)

Message-ID: <248997790.14326.1582639167881@office.mailbox.org>
Permalink:  ../248997790.14326.1582639167881@office.mailbox.org/
Also on:    postgresql.org/message-id/248997790.14326.1582639167881@office.mailbox.org

 · 

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: eli.mach@mailbox.org, daniel@yesql.se
  Subject: Re: pretty_bool in pg_get_constraintdef has no effect since pg >= 9
  In-Reply-To: <248997790.14326.1582639167881@office.mailbox.org>
  References: <490036036.13996.1582635382921@office.mailbox.org> <15619FB4-5F5A-4A71-B945-78C3FB82FAED@yesql.se> <248997790.14326.1582639167881@office.mailbox.org>

* 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