pg_get_viewdefs() indentation considered harmful

Поиск
Список
Период
Сортировка
От Greg Stark
Тема pg_get_viewdefs() indentation considered harmful
Дата
Msg-id CAM-w4HNKU9Y38QrLxPMOYp+CSfjfcrAoJ4rs1nsO+uBt79qGXQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: pg_get_viewdefs() indentation considered harmful  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
We're finding it more and more common for people to define partitioned
table views with hundreds or thousands of union branches.
pg_get_viewdefs indents each branch of the union by 8 spaces more than
the previous branch. The net effect is that the size of the output is
O(n^2) bytes just for the indentation spaces. If your union branches
are about 5 lines long then you hit MaxAlloc after about 5,000
branches. And incidentally there's no CHECK_FOR_INTERRUPTS in that
loop.

I would actually suggest pg_dump should be able to pass a flag to
disable indentation but then I noticed that all the code is already
there. It's just that every single variation of pg_get_viewdef sets
the indentation flag explicitly. I wonder if this was the intended
behaviour. Shouldn't pg_get_viewdef(view, false) set indentation off?

-- 
greg



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

Предыдущее
От: Florian Pflug
Дата:
Сообщение: Re: Standalone synchronous master
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_get_viewdefs() indentation considered harmful