pg_execute_from_file review - Mailing list pgsql-hackers

From Joshua Tolley
Subject pg_execute_from_file review
Date
Msg-id 4cee0392.2432640a.4fb6.16c4@mx.google.com
Whole thread Raw
Responses Re: pg_execute_from_file review
List 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
Ineeded 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
doit 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

pgsql-hackers by date:

Previous
From: KaiGai Kohei
Date:
Subject: Re: contrib: auth_delay module
Next
From: Chang Chao
Date:
Subject: How strings are sorted by LC_COLLATE specifically?