cached plan must not change result type

From: Jan Bilek <jan(dot)bilek(at)eftlab(dot)com(dot)au>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: cached plan must not change result type
Date: 2018-03-07 23:06:59
Message-ID: SYXPR01MB0701122A755200ECF78A8405B5D80@SYXPR01MB0701.ausprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

Our client noticed a problem which occurred so far twice, but might be having quite significant impact on our application processing in production: ResStatus: PGRES_FATAL_ERROR transaction. ErrorMessage: ERROR: cached plan must not change result type.

Reading through the documentation problem is quite understood on our side, while most probably caused by our implementation of Virtual Partitioning on postgresql, by triggering database schema update through the application upgrade procedure or simply by altering one of the tables manually - so far so good.

Now, our developers came with a solution where we check return value from PQresultStatus(x) for PGRES_FATAL_ERROR and then if the error message from PQresultErrorMessage(x) contains "cached plan must not change result type" we delete statement and prepare it again.

I would like to ask, would you see this solution in general as fine, or is there any better way to achieve this? I particularly dislike the part when we are trying matching return string on "cached plan must not change result type" as error messages might change (e.g. situations using different locales), is there any way how to get around this e.g. with enumerator?

Thank you,
Jan

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-03-07 23:13:29 Re: Prefixing schema name
Previous Message Tiffany Thang 2018-03-07 23:05:16 Prefixing schema name