[PATCH] Better logging of COPY queries if log_statement='all'

From: Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] Better logging of COPY queries if log_statement='all'
Date: 2016-10-17 13:57:54
Message-ID: 20161017135753.GA6204@e733.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

Sometimes it's useful to log content of files used in COPY ... TO ... and
COPY ... FROM ... queries. Unfortunately PostgreSQL doesn't allow to do
it, even if log_statement='all'. Suggested patch fixes this.

Log example:

```
LOG: statement: create table test (k int, v text);
LOG: statement: insert into test values (111, 'aaa'), (222, 'bbb');
LOG: statement: copy test to '/tmp/copy.txt';
LOG: statement: 111 aaa
LOG: statement: 222 bbb
LOG: statement: delete from test;
LOG: statement: copy test from '/tmp/copy.txt';
LOG: statement: 111 aaa
LOG: statement: 222 bbb
```
--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
log-statement-all-for-copy.patch text/x-diff 2.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2016-10-17 14:21:44 Re: [PATCH] Better logging of COPY queries if log_statement='all'
Previous Message Robert Haas 2016-10-17 13:51:49 Re: postgres_fdw super user checks