Re: BUG #16655: pg_dump segfault when excluding postgis table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #16655: pg_dump segfault when excluding postgis table
Дата
Msg-id 2037841.1602032684@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #16655: pg_dump segfault when excluding postgis table  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #16655: pg_dump segfault when excluding postgis table  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-bugs
I wrote:
> It's not entirely clear to me why we don't get a crash on the case in
> pre-v12 branches, but I'm inclined to apply these patches all the way
> back anyway, as they definitely seem like robustness improvements
> whether or not a given branch accidentally fails to fail.

OK, so after a bit of "git bisect"ing, things are clearer:

* Before 3eb3d3e78, there was no code path (or at least no known one)
that would allow control to arrive at dumpTableSchema without having
done getTableAttrs.  So my original thought that that was a logical
prerequisite was correct.

* Before v12, dumpTableData_insert would kind-of-accidentally work
without having done getTableAttrs, because it got all the needed
info from the PGresult of its "SELECT * FROM ONLY table" query,
rather than looking at the per-column data in the TableInfo.
v12 added a check on the attgenerated[] data, causing that to not
work anymore, which was the reported bug leading to 3eb3d3e78.

* However, the dumpTableData_copy code path also was only
accidentally working without getTableAttrs.  That left numattrs
zero in the TableInfo, causing fmtCopyColumnList to return an
empty string, which works almost all the time for both the
data fetching and the eventual reload.  It'd only fail obviously
in corner cases where the column order needed to be different at
reload; so it's not so surprising that we'd not noticed.
Nonetheless, *both* the COPY and INSERT code paths are dependent
on getTableAttrs, contrary to the discussion in the other thread;
and the COPY case's dependency goes back further.

I conclude that:

* My 0003 is the actually important fix.  0001 just adds some
robustness, which is not a bad thing but it doesn't seem critical.

* I should revise 0002 so that it exercises the COPY path and
checks that the correct column list is given.  I expect this will
show that there's a problem further back than v12.

* We should add Asserts in both dumpTableData and dumpTableSchema
to verify that "interesting" is set, in hopes of catching any
future mistakes of this ilk.

            regards, tom lane



В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #16658: HSTORE typecast exception is XX000 - inconsistent with the other cast exceptions (22xxx)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #16657: Index not reflecting update when date to timestamp comparison operation used in index scan