Re: proposal: function parse_ident

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: proposal: function parse_ident
Дата
Msg-id CAFj8pRCUeGWtG9NZ1N2GZR42WLpwK4LuoTWgLF4a7n2V14HyXA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proposal: function parse_ident  (Corey Huinker <corey.huinker@gmail.com>)
Ответы Re: proposal: function parse_ident  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: proposal: function parse_ident  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers


2015-09-08 20:17 GMT+02:00 Corey Huinker <corey.huinker@gmail.com>:

I would have immediate use for this. So often a function is written with a table name as a parameter and it's not immediately clear if the schema is to be parsed out of the string, prescribed, or a separate parameter...in which case the function signature now has a clumsy optional schema parameter somewhere. I've written this bit of code probably five times now, let's make it a solved problem.

text[] return seems most sensible. While I can see the use for a record output, it wouldn't be used as often.

here is a patch

I cannot to use current SplitIdentifierString because it is designed for different purpose - and it cannot to separate non identifier part. But the code is simple - and will be cleaned.

 postgres=# select * from parse_ident('"AHOJ".NAZDAR[]'::text);
┌───────────────┬───────┐
│     parts     │ other │
╞═══════════════╪═══════╡
│ {AHOJ,nazdar} │ []    │
└───────────────┴───────┘
(1 row)


Regards

Pavel

Вложения

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

Предыдущее
От: Jeff Janes
Дата:
Сообщение: ALTER INDEX...SET tab completion
Следующее
От: "Daniel Verite"
Дата:
Сообщение: Re: [patch] Proposal for \rotate in psql