Re: Drop or alter column under load give ERROR #42804 structure of query does not match function result type:

From: Andres Freund <andres(at)anarazel(dot)de>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Victor Blomqvist <vb(at)viblo(dot)se>, pgsql-general(at)postgresql(dot)org
Subject: Re: Drop or alter column under load give ERROR #42804 structure of query does not match function result type:
Date: 2015-10-12 13:48:52
Message-ID: 20151012134852.GB30738@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2015-10-12 06:42:52 -0700, Adrian Klaver wrote:
> >My guess is that the problem here is that table level locking prevents
> >modification of the "users" type when the table is used, but there's no
> >locking preventing the columns to be dropped while the function is
> >used. So what happens is that 1) the function is parsed & planned 2)
> >DROP COLUMN is executed 3) the contained statement is executed 4) a
> >mismatch between the contained statement and the function definition is
> >detected.
>
> Except per Albe's[1] example, the above sequence of events does not fail. It
> fails in Victors's case when the server is under load, so it seems there is
> another factor in play.

The above sequence is only problematic if 2) happens exactly between 1)
and 3), which is not particularly likely given that 1) is a very quick
operation.

Greetings,

Andres Freund

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2015-10-12 13:53:14 Re: Drop or alter column under load give ERROR #42804 structure of query does not match function result type:
Previous Message Adrian Klaver 2015-10-12 13:42:52 Re: Drop or alter column under load give ERROR #42804 structure of query does not match function result type: