| From: | Piotr Marcinczyk <pmarcinc(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Add \i option to bring in the specified file as a quoted literal |
| Date: | 2013-10-21 21:34:55 |
| Message-ID: | 1382391295.26698.61.camel@centos |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gavin Flower | 2013-10-21 21:47:15 | Re: Add min and max execute statement time in pg_stat_statement |
| Previous Message | Josh Berkus | 2013-10-21 20:57:45 | Re: Turning recovery.conf into GUCs |