(PostgreSQL 17) View usage resulting in 'ERROR: unrecognized node type: 2'

  • Jump to comment-1
    Martin Goodson<kaemaril@googlemail.com>
    Mar 12, 2026, 9:03 PM UTC
    I don't know if anyone has seen this, maybe it's a very common error I've just never come across before, but I'm encountering the following problem:
    I've exported some views from a PG14 database and loaded them into a brand new PG17 database via a plain text format pg_dump.
    No errors were reported during the dump, so no problems creating the views reported.
    However, attempting to query the views - which are pretty complex, to be fair - result in the query erroring immediately with 'ERROR: unrecognized node type: 2'
    I've tried repeating the load from the pg_dump file, and it still errors immediately with the same error message.
    I've tried creating a copy of one of the views (extracting the view definition with pggetviewdef, and wrapping a create view around it) ... that results in a new view that is created successfully, but which still results in an immediate 'ERROR: unrecognized node type: 2' when you query the view.
    Unfortunately I cannot provide the view definition due to confidentiality agreements 🙁
    Any suggestions to what might be the underlying cause for this? Has this happened anywhere else? Is there some manner of issue with complexity in views in PG17?
    Any suggestions, or further information, would be very gratefully received 🙂
    Thank you.
    --
    --
    Martin Goodson.
    "Have you thought up some clever plan, Doctor?"
    "Yes, Jamie, I believe I have."
    "What're you going to do?"
    "Bung a rock at it."
    --
    --
    Martin Goodson.
    "Have you thought up some clever plan, Doctor?"
    "Yes, Jamie, I believe I have."
    "What're you going to do?"
    "Bung a rock at it."
    • Jump to comment-1
      Justin Swanhart<greenlion@gmail.com>
      Mar 12, 2026, 9:43 PM UTC
      On Thu, Mar 12, 2026 at 5:03 PM Martin Goodson <kaemaril@googlemail.com>
      wrote:
      Unfortunately I cannot provide the view definition due to
      confidentiality agreements 🙁

      Any suggestions to what might be the underlying cause for this? Has this
      happened anywhere else? Is there some manner of issue with complexity in
      views in PG17?

      Any suggestions, or further information, would be very gratefully
      received 🙂

      Thank you.

      See some debugging suggestions on this topic from earlier discussions in
      the list:
      https://www.postgresql.org/message-id/42a5f581-0482-0c3f-f36e-04c90e6358cb%40enterprisedb.com
      The other suggestion would be to simplify the view as much as possible
      until the problem goes away. Then you'll know what the problem is.
      • Jump to comment-1
        Michael Paquier<michael@paquier.xyz>
        Mar 13, 2026, 2:00 AM UTC
        On Thu, Mar 12, 2026 at 05:43:00PM -0400, Justin Swanhart wrote:
        The other suggestion would be to simplify the view as much as possible
        until the problem goes away. Then you'll know what the problem is.
        One could argue that this is a bug, but I doubt that anybody is going
        to dive in details into that without a self-contained test case.
        --
        Michael
    • Jump to comment-1
      Tom Lane<tgl@sss.pgh.pa.us>
      Mar 13, 2026, 2:22 AM UTC
      Martin Goodson <kaemaril@googlemail.com> writes:
      I've exported some views from a PG14 database and loaded them into a
      brand new PG17 database via a plain text format pg_dump.
      No errors were reported during the dump, so no problems creating the
      views reported.
      However, attempting to query the views - which are pretty complex, to be
      fair - result in the query erroring immediately with 'ERROR:
      unrecognized node type: 2'
      That is certainly a bug, but there's zero hope of anyone fixing it
      without a reproducible test case to poke at.
      Looking at our commit log, there was a fix in 17.3 for a problem that
      resulted in "unrecognized node type" errors [1], so it'd behoove you to
      make sure you are running 17.recent before spending any more effort.
      		regards, tom lane
      [1] https://www.postgresql.org/message-id/flat/18778-24cd399df6c806af%40postgresql.org