pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedFailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
5+ messages / 3 participants
[nested] [flat]
* FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
@ 2019-12-01 23:31 Manuel Rigger <rigger.manuel@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Manuel Rigger @ 2019-12-01 23:31 UTC (permalink / raw)
To: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Hi everyone,
The following statements result in an assertion error on the latest
trunk version (c01ac6d):
CREATE TABLE t0(c0 TEXT COLLATE "POSIX");
CREATE VIEW v0(c0) AS (SELECT (t0.c0 COLLATE "C")::INT FROM t0); --
FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
When building without assertions, the CREATE VIEW statement results in
an error instead:
ERROR: collations are not supported by type integer
Best,
Manuel
Full stack trace:
TRAP: FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
postgres: postgres testdb [local] CREATE
VIEW(ExceptionalCondition+0x76)[0x563c55747066]
postgres: postgres testdb [local] CREATE VIEW(DefineView+0x4cb)[0x563c55487cdb]
postgres: postgres testdb [local] CREATE VIEW(+0x41cebc)[0x563c5561febc]
postgres: postgres testdb [local] CREATE
VIEW(standard_ProcessUtility+0x148)[0x563c5561e9f8]
postgres: postgres testdb [local] CREATE VIEW(+0x418a64)[0x563c5561ba64]
postgres: postgres testdb [local] CREATE VIEW(+0x41961b)[0x563c5561c61b]
postgres: postgres testdb [local] CREATE VIEW(PortalRun+0x17a)[0x563c5561d45a]
postgres: postgres testdb [local] CREATE VIEW(+0x415fed)[0x563c55618fed]
postgres: postgres testdb [local] CREATE
VIEW(PostgresMain+0x14ef)[0x563c5561a8cf]
postgres: postgres testdb [local] CREATE VIEW(+0x38d8d4)[0x563c555908d4]
postgres: postgres testdb [local] CREATE
VIEW(PostmasterMain+0xe01)[0x563c555917f1]
postgres: postgres testdb [local] CREATE VIEW(main+0x4b8)[0x563c552b9058]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb)[0x7f80170ddb6b]
postgres: postgres testdb [local] CREATE VIEW(_start+0x2a)[0x563c552b90fa]
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
@ 2019-12-02 01:20 Thomas Munro <thomas.munro@gmail.com>
parent: Manuel Rigger <rigger.manuel@gmail.com>
0 siblings, 2 replies; 5+ messages in thread
From: Thomas Munro @ 2019-12-02 01:20 UTC (permalink / raw)
To: Manuel Rigger <rigger.manuel@gmail.com>; +Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On Mon, Dec 2, 2019 at 12:32 PM Manuel Rigger <rigger.manuel@gmail.com> wrote:
> CREATE TABLE t0(c0 TEXT COLLATE "POSIX");
> CREATE VIEW v0(c0) AS (SELECT (t0.c0 COLLATE "C")::INT FROM t0); --
> FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
>
> When building without assertions, the CREATE VIEW statement results in
> an error instead:
>
> ERROR: collations are not supported by type integer
I think the options are to add a check and ereport() instead of an
assertion, or just remove the assertion and let BuildDescForRelation()
report the error as it does in non-assert builds. I think the latter
is better, since it seems well established that BuildDescForRelation()
will complain about that via its call to GetColumnDefCollation().
Here's a patch to do that.
> TRAP: FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
> postgres: postgres testdb [local] CREATE
> VIEW(ExceptionalCondition+0x76)[0x563c55747066]
> postgres: postgres testdb [local] CREATE VIEW(DefineView+0x4cb)[0x563c55487cdb]
> ...
I'm loving these new back traces.
Attachments:
0001-Remove-assertion-about-collations-from-DefineView.patch (application/octet-stream, 1.2K) download
From 3014956d94a241d509e98312bad0731ef7730007 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Mon, 2 Dec 2019 13:57:17 +1300
Subject: [PATCH] Remove assertion about collations from DefineView().
If a user has specified a collation for an expression of a
type that isn't collatable, BuildDescForRelation() will
raise an error further down, but until then we can't make
assertions about that.
Reported-by: Manuel Rigger
Discussion: https://postgr.es/m/CA%2Bu7OA5TwqWTrvRoFOF1Vipf5WpfcbQYwtLGzNVXGwa6Ptor9w%40mail.gmail.com
---
src/backend/commands/view.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index 9b5148093b..816b0b6299 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -85,8 +85,11 @@ DefineVirtualRelation(RangeVar *relation, List *tlist, bool replace,
def->colname),
errhint("Use the COLLATE clause to set the collation explicitly.")));
}
- else
- Assert(!OidIsValid(def->collOid));
+
+ /*
+ * If it's not collatable and a collation has been provided, then
+ * BuildDescForRelation() will raise an error further down.
+ */
attrList = lappend(attrList, def);
}
--
2.23.0
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
@ 2019-12-13 09:56 Manuel Rigger <rigger.manuel@gmail.com>
parent: Thomas Munro <thomas.munro@gmail.com>
1 sibling, 0 replies; 5+ messages in thread
From: Manuel Rigger @ 2019-12-13 09:56 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@gmail.com>; +Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Hi,
Thanks for the fix. Will this patch be merged soon?
Best,
Manuel
On Mon, Dec 2, 2019 at 2:21 AM Thomas Munro <thomas.munro@gmail.com> wrote:
>
> On Mon, Dec 2, 2019 at 12:32 PM Manuel Rigger <rigger.manuel@gmail.com> wrote:
> > CREATE TABLE t0(c0 TEXT COLLATE "POSIX");
> > CREATE VIEW v0(c0) AS (SELECT (t0.c0 COLLATE "C")::INT FROM t0); --
> > FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
> >
> > When building without assertions, the CREATE VIEW statement results in
> > an error instead:
> >
> > ERROR: collations are not supported by type integer
>
> I think the options are to add a check and ereport() instead of an
> assertion, or just remove the assertion and let BuildDescForRelation()
> report the error as it does in non-assert builds. I think the latter
> is better, since it seems well established that BuildDescForRelation()
> will complain about that via its call to GetColumnDefCollation().
> Here's a patch to do that.
>
> > TRAP: FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
> > postgres: postgres testdb [local] CREATE
> > VIEW(ExceptionalCondition+0x76)[0x563c55747066]
> > postgres: postgres testdb [local] CREATE VIEW(DefineView+0x4cb)[0x563c55487cdb]
> > ...
>
> I'm loving these new back traces.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
@ 2020-06-02 21:30 Alvaro Herrera <alvherre@2ndquadrant.com>
parent: Thomas Munro <thomas.munro@gmail.com>
1 sibling, 1 reply; 5+ messages in thread
From: Alvaro Herrera @ 2020-06-02 21:30 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@gmail.com>; +Cc: Manuel Rigger <rigger.manuel@gmail.com>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On 2019-Dec-02, Thomas Munro wrote:
> On Mon, Dec 2, 2019 at 12:32 PM Manuel Rigger <rigger.manuel@gmail.com> wrote:
> > CREATE TABLE t0(c0 TEXT COLLATE "POSIX");
> > CREATE VIEW v0(c0) AS (SELECT (t0.c0 COLLATE "C")::INT FROM t0); --
> > FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
> >
> > When building without assertions, the CREATE VIEW statement results in
> > an error instead:
> >
> > ERROR: collations are not supported by type integer
>
> I think the options are to add a check and ereport() instead of an
> assertion, or just remove the assertion and let BuildDescForRelation()
> report the error as it does in non-assert builds. I think the latter
> is better, since it seems well established that BuildDescForRelation()
> will complain about that via its call to GetColumnDefCollation().
> Here's a patch to do that.
This has not been applied yet AFAICS. Thomas, are you getting to this
one soon?
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
@ 2020-06-02 22:50 Thomas Munro <thomas.munro@gmail.com>
parent: Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Munro @ 2020-06-02 22:50 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: Manuel Rigger <rigger.manuel@gmail.com>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On Wed, Jun 3, 2020 at 9:30 AM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> On 2019-Dec-02, Thomas Munro wrote:
> > On Mon, Dec 2, 2019 at 12:32 PM Manuel Rigger <rigger.manuel@gmail.com> wrote:
> > > CREATE TABLE t0(c0 TEXT COLLATE "POSIX");
> > > CREATE VIEW v0(c0) AS (SELECT (t0.c0 COLLATE "C")::INT FROM t0); --
> > > FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
> > >
> > > When building without assertions, the CREATE VIEW statement results in
> > > an error instead:
> > >
> > > ERROR: collations are not supported by type integer
> >
> > I think the options are to add a check and ereport() instead of an
> > assertion, or just remove the assertion and let BuildDescForRelation()
> > report the error as it does in non-assert builds. I think the latter
> > is better, since it seems well established that BuildDescForRelation()
> > will complain about that via its call to GetColumnDefCollation().
> > Here's a patch to do that.
>
> This has not been applied yet AFAICS. Thomas, are you getting to this
> one soon?
Thanks for the reminder. Will do.
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2020-06-02 22:50 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-01 23:31 FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89) Manuel Rigger <rigger.manuel@gmail.com>
2019-12-02 01:20 ` Thomas Munro <thomas.munro@gmail.com>
2019-12-13 09:56 ` Manuel Rigger <rigger.manuel@gmail.com>
2020-06-02 21:30 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2020-06-02 22:50 ` Thomas Munro <thomas.munro@gmail.com>
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