Add \i option to bring in the specified file as a quoted literal

Поиск
Список
Период
Сортировка
Искать
От
Piotr Marcinczyk
Тема
Add \i option to bring in the specified file as a quoted literal
Дата
Msg-id
1382391295.26698.61.camel@centos
Список
Дерево обсуждения
Add \i option to bring in the specified file as a quoted literal Piotr Marcinczyk <pmarcinc@gmail.com>
Re: Add \i option to bring in the specified file as a quoted literal Amit Kapila <amit.kapila16@gmail.com>
Re: Add \i option to bring in the specified file as a quoted literal Bruce Momjian <bruce@momjian.us>
Re: Add \i option to bring in the specified file as a quoted literal Amit Kapila <amit.kapila16@gmail.com>
Re: Add \i option to bring in the specified file as a quoted literal Bruce Momjian <bruce@momjian.us>
Re: Add \i option to bring in the specified file as a quoted literal Piotr Marcinczyk <pmarcinc@gmail.com>
Re: Add \i option to bring in the specified file as a quoted literal Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Add \i option to bring in the specified file as a quoted literal Amit Kapila <amit.kapila16@gmail.com>
Re: Add \i option to bring in the specified file as a quoted literal Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Add \i option to bring in the specified file as a quoted literal Piotr Marcinczyk <pmarcinc@gmail.com>
Hi,

I would like to implement item from TODO marked as easy: "Add \i option
to bring in the specified file as a quoted literal". I understand intent
of this item, to be able to have parts of query written in separate
files (now it is impossible, because \i tries to execute content of file
as a separate command by function process_file).

Implementation:
I will add command "iq" and "include_quoted" in src/bin/psql/command.c
(in the same block where "i" and "ir" are implemented). If "iq" is
detected I will call new function do_append(fname, query_buf) which will
read file into query_buffer and return status PSQL_CMD_NEWEDIT.

User perespective:
User will be able to append file to current buffer. It will be possible
to include code of procedure, or where part of select statement.
ex:
select * from
/iq where_part.sql
and lang_name='SQL'
;

Questions:
Variables like :myvar will be replaced with their values, is that ok?
Shall I start to code this patch?

Best regards
Piotr Marcinczyk



В списке pgsql-hackers по дате отправления
От: Dimitri Fontaine
Дата:
От: Alvaro Herrera
Дата:
FAQ