Re: BUG #12789: Views defined with VALUES lose their column names when dumped

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: BUG #12789: Views defined with VALUES lose their column names when dumped
Дата
Msg-id 87ioexfb91.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на BUG #12789: Views defined with VALUES lose their column names when dumped  (programble@gmail.com)
Ответы Re: BUG #12789: Views defined with VALUES lose their column names when dumped
Список pgsql-bugs
>>>>> ">" == programble  <programble@gmail.com> writes:

 >> The following bug has been logged on the website:
 >> Bug reference:      12789
 >> Logged by:          Curtis McEnroe
 >> Email address:      programble@gmail.com
 >> PostgreSQL version: 9.4.1
 >> Operating system:   Mac OS X 10.10.1
 >> Description:

 >> A view created with explicit column names and defined as a VALUES statement
 >> will lose its column names when dumped. When the dump is restored, the
 >> view's columns are named "column1", "column2", etc.

 >> I wrote a short repro script here:
 >> https://gist.github.com/programble/a416df496bfb41259c86

For future reference and as a simpler testcase than the one in the
script:

# create view v1(a) as values (1);
CREATE VIEW

# select pg_get_viewdef('v1'::regclass);
 pg_get_viewdef
----------------
  VALUES (1);

Notice that the column name "a" is lost. Since pg_dump and so on rely on
pg_get_viewdef, dump and restore changes the column name back to
"column1".

The culprit is obviously in ruleutils.c:
get_simple_values_rte/get_values_def, which mistakenly thinks it only
has to deal with the result of transformValuesClause(), not considering
that the result of transformValuesClause might have been further
mogrified by DefineView. Treating this case as not being "simple" might
be one approach... not sure of the best way to detect that.

--
Andrew (irc:RhodiumToad)

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

Предыдущее
От: programble@gmail.com
Дата:
Сообщение: BUG #12789: Views defined with VALUES lose their column names when dumped
Следующее
От: lr@pcorp.us
Дата:
Сообщение: BUG #12792: I can do a SELECT with no fields