BUG #14876: Segmentation fault with JSONB column used in store proc that gets used by view and later altered
samuel.horwitz@gmail.com
From: samuel.horwitz@gmail.com
To: pgsql-bugs@postgresql.org
Cc: samuel.horwitz@gmail.com
Date: 2017-10-26T18:40:35Z
Lists: pgsql-bugs
The following bug has been logged on the website: Bug reference: 14876 Logged by: Samuel Horwitz Email address: samuel.horwitz@gmail.com PostgreSQL version: 10.0 Operating system: OS X (but running inside Docker official image) Description: I have a table that includes a JSONB column. I have a view that is based on this table that reflects this JSONB column. I have yet another view, based on the first view, that passes rows from the first view into a stored PL/PGSQL procedure as anyelement. This stored procedure builds a JSON object from it's input and returns that new JSON object. One of the values on the new JSON object is the value of the JSONB column that has gone through two views by this point, into the procedure. At this point everything works. Selecting from the second view is fine. However, if I alter the stored procedure's resulting JSON in any way, this will cause selecting from the second view to trigger a segfault. The solution is easy: regenerate the second view by just CREATE OR REPLACEing it with the existing definition. I have created a public Gist with reproduction steps and dumps, attached here: https://gist.github.com/samuelhorwitz/0bc77a517238914512fc8cdf50d217cd Please scroll to the bottom (or click here https://gist.github.com/samuelhorwitz/0bc77a517238914512fc8cdf50d217cd#gistcomment-2240442) to see my steps. This happens in 9.6.5 as well as 10. Samuel Horwitz
Commits
-
Fix crash when columns have been added to the end of a view.
- d5b760ecb5e1 11.0 landed
- ddde3b4f3e88 10.1 landed
- acd3287e437e 9.5.10 landed
- 9d15b8b36a91 9.3.20 landed
- 80e79718d0ea 9.2.24 landed
- 7e5e8b36d478 9.6.6 landed
- 66104119e1fb 9.4.15 landed