Re: pgsql: Add support for piping COPY to/from an external program. - Mailing list pgsql-committers

From Alvaro Herrera
Subject Re: pgsql: Add support for piping COPY to/from an external program.
Date
Msg-id 20130228163224.GL9507@alvh.no-ip.org
Whole thread Raw
In response to pgsql: Add support for piping COPY to/from an external program.  (Heikki Linnakangas <heikki.linnakangas@iki.fi>)
List pgsql-committers
Heikki Linnakangas wrote:

> This creates a new function in pgport, wait_result_to_str(), which can
> be used to convert the exit status of a process, as returned by wait(3),
> to a human-readable string.

You have this:

+#ifndef FRONTEND
+   result = pstrdup(str);
+#else
+   result = strdup(str);
+#endif

This kind of thing is no longer necessary.  In frontend, libpgcommon
provides a pstrdup() implementation which is strdup() plus error check,
so you can reduce the above to simply

    result = pstrdup(str);

and it should work everywhere.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


pgsql-committers by date:

Previous
From: Thom Brown
Date:
Subject: Re: pgsql: Add CREATE RECURSIVE VIEW syntax
Next
From: Andres Freund
Date:
Subject: Re: pgsql: Blind attempt at fixing the non-MSVC Windows builds