Add \i option to bring in the specified file as a quoted literal - Mailing list pgsql-hackers

From Piotr Marcinczyk
Subject Add \i option to bring in the specified file as a quoted literal
Date
Msg-id 1382391295.26698.61.camel@centos
Whole thread Raw
Responses Re: Add \i option to bring in the specified file as a quoted literal  (Amit Kapila <amit.kapila16@gmail.com>)
List 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




pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: Cube extension point support // GSoC'13
Next
From: Alvaro Herrera
Date:
Subject: Re: Add min and max execute statement time in pg_stat_statement