Determining postgis version from pg_dump

Erik Wienhold ewie at ewie.name
Fri Mar 22 12:55:40 PDT 2024


On 2024-03-22 20:00 +0100, Regina Obe wrote:
> I don’t think so.  As I recall when you do a pg_dump, it just stores the 
> CREATE EXTENSION … line without a VERSION so you can’t tell.
> 
> I could be mistaken though.

No, you're right.  Omitting the version is intentional.  From the
pg_dump source:

	/*
	 * In a regular dump, we simply create the extension, intentionally
	 * not specifying a version, so that the destination installation's
	 * default version is used.
	 *
	 * Use of IF NOT EXISTS here is unlike our behavior for other object
	 * types; but there are various scenarios in which it's convenient to
	 * manually create the desired extension before restoring, so we
	 * prefer to allow it to exist already.
	 */
	appendPQExpBuffer(q, "CREATE EXTENSION IF NOT EXISTS %s WITH SCHEMA %s;\n",
					  qextname, fmtId(extinfo->namespace));

-- 
Erik


More information about the postgis-users mailing list