Re: proposal: psql \setfileref - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: proposal: psql \setfileref
Date
Msg-id CAFj8pRCrhKQ96zFDH-gkcc0-UYWcmz13=24RmThqr+xWdh-+8A@mail.gmail.com
Whole thread Raw
In response to Re: proposal: psql \setfileref  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
Hi

2016-11-13 19:46 GMT+01:00 Pavel Stehule <pavel.stehule@gmail.com>:
Hi

I am sending a initial implementation of psql content commands. This design is reaction to Tom's objections against psql file ref variables. This design is more cleaner, more explicit and more practical - import can be in one step.

Now supported commands are:

r - read file without any modification
rq - read file, escape as literal and use outer quotes
rb - read binary file - transform to hex code string
rbq - read binary file, transform to hex code string and use outer quotes

Usage:

create table testt(a xml);
insert into test values( {rq /home/pavel/.local/share/rhythmbox/rhythmdb.xml} );
\set xxx {r /home/pavel/.local/share/rhythmbox/rhythmdb.xml}

This patch is demo of this design - one part is redundant - I'll clean it in next iteration.

Regards


here is cleaned patch

* the behave is much more psqlish - show error only when the command is exactly detected - errors are related to processed files only - the behave is similar to psql variables - we doesn't raise a error, when the variable doesn't exists.
* no more duplicate code
* some basic doc
* some basic regress tests

Regards

Pavel



 
Pavel


Attachment

pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Snapshot too old logging
Next
From: Robert Haas
Date:
Subject: Re: pg_dump, pg_dumpall and data durability