pg_execute_from_file review

From: Joshua Tolley <eggyknap(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_execute_from_file review
Date: 2010-11-25 06:34:34
Message-ID: 4cee0392.2432640a.4fb6.16c4@mx.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've just looked at pg_execute_from_file[1]. The idea here is to execute all
the SQL commands in a given file. My comments:

* It applies well enough, and builds fine
* It seems to work, and I've not come up with a way to make it break
* It seems useful, and to follow the limited design discussion relevant to it
* It looks more or less like the rest of the code base, so far as I know

Various questions and/or nits:

* I'd like to see the docs slightly expanded, specifically to describe
parameter replacement. I wondered for a while if I needed to set of
parameters in any specific way, before reading the code and realizing they
can be whatever I want.
* Does anyone think it needs representation in the test suite?
* Is it at all bad to include spi.h in genfile.c? IOW should this function
live elsewhere? It seems reasonable to me to do it as written, but I thought
I'd ask.
* In the snippet below, it seems best just to use palloc0():
query_string = (char *)palloc((fsize+1)*sizeof(char));
memset(query_string, 0, fsize+1);
* Shouldn't it include SPI_push() and SPI_pop()?

[1] http://archives.postgresql.org/message-id/m262wf6fnz.fsf@2ndQuadrant.fr

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chang Chao 2010-11-25 06:40:58 How strings are sorted by LC_COLLATE specifically?
Previous Message KaiGai Kohei 2010-11-25 06:18:38 Re: contrib: auth_delay module