Re: FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
Date: 2019-12-02 01:20:55
Message-ID: CA+hUKGLYApN1sZ1193iyPP3SfCs_D7jviP3BzzgbHqm5BATsBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Dec 2, 2019 at 12:32 PM Manuel Rigger <rigger(dot)manuel(at)gmail(dot)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.

Attachment Content-Type Size
0001-Remove-assertion-about-collations-from-DefineView.patch application/octet-stream 1.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-12-02 04:35:47 Re: logical replication: could not create file "state.tmp": File exists
Previous Message Manuel Rigger 2019-12-01 23:31:45 FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)