Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j6bGM-0000Wo-18 for pgsql-bugs@arkaria.postgresql.org; Tue, 25 Feb 2020 14:32:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j6bGJ-00042e-C7 for pgsql-bugs@arkaria.postgresql.org; Tue, 25 Feb 2020 14:32:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j6akQ-00008h-RU for pgsql-bugs@lists.postgresql.org; Tue, 25 Feb 2020 13:59:42 +0000 Received: from mout-p-201.mailbox.org ([2001:67c:2050::465:201]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.92) (envelope-from ) id 1j6akM-00053T-1s for pgsql-bugs@postgresql.org; Tue, 25 Feb 2020 13:59:42 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 48RgXk4TJczQlSW; Tue, 25 Feb 2020 14:59:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mailbox.org; h= content-transfer-encoding:content-type:content-type:mime-version :subject:subject:references:in-reply-to:message-id:reply-to:from :from:date:date:received; s=mail20150812; t=1582639168; bh=jJEcr zFO1utMyZG0CqaE0BXi8xvtajvjnRA1xIPnccw=; b=V1gBctVkFQbqsRnLVBayo TpDZBCIioXjcsran+Q3SezKPnhiJtB5o5h0ld1zJ9/jpRyOVBRT63HlUmBoaa3+G HPHxtLg7zKkPbaZpjsMPq1UdN+Pl+BSX/p0pDuinA2AQX6e0VfleJEZnSVb56Yp0 nMR4i76Jdlwmr8YI//r4jEuoa4HABLlQLt+ISDOU94DRz/ByIV0lZujMjfobwjHX UtuPSlEw1dW96ISDAn2ZNiezyM5fkI4BW5HcIQLi2xi6ycv2IaTps1LBhadkZUZp rL+VVtL3sT/K2je/iveD8+KSkEIMosGyMkuGS4VT8tkxxqIaptGSBUlSdsgIdCCI w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1582639172; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TfxviPwLhOlkFQWsLftcZ5j2eEldiMsCPPINzUATnnw=; b=p52xZv9jH9Dc/aG9DYogY4H0JZ7zvNiq/ihNmW5SwSTp6APZ7IYnkGv/fas5wvknlz6YnX oo6WZybbi42qQRI3pIwgT1g5zsamGtB2GH7iwjAMPfR1QdZ+kxEoB8ygbQnQK+rSLsnT1g NQ0PdNQL00o8xMN2cWoE3r68wWHEHwKvxaUnaKc930WpESj3ppSaTGImnUtd8VZ9bUg4rL 1xlE0BqCeFz7K18JA3oA91CyNLKfDc/LpRgfi02BTG6MMsR8ZW7r3OkM+l0cvBsW0PjGys C8/B5ym+NLN7w/ETeoeOFgXduUON4nAUBfj4oQ2asTSOmZwR4+u1CcC6fD6CuA== X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id 18_XFKu7v4CJ; Tue, 25 Feb 2020 14:59:28 +0100 (CET) Date: Tue, 25 Feb 2020 14:59:27 +0100 (CET) From: eli.mach@mailbox.org Reply-To: eli.mach@mailbox.org To: Daniel Gustafsson Cc: "pgsql-bugs@postgresql.org" Message-ID: <248997790.14326.1582639167881@office.mailbox.org> In-Reply-To: <15619FB4-5F5A-4A71-B945-78C3FB82FAED@yesql.se> References: <490036036.13996.1582635382921@office.mailbox.org> <15619FB4-5F5A-4A71-B945-78C3FB82FAED@yesql.se> Subject: Re: pretty_bool in pg_get_constraintdef has no effect since pg >= 9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 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