Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 246843 - configuring dev-db/postgis-1.3.3 fails with ERROR: VACUUM cannot be executed from a function or multi-command string
Summary: configuring dev-db/postgis-1.3.3 fails with ERROR: VACUUM cannot be executed...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-15 12:03 UTC by Burak Arslan
Modified: 2009-06-13 20:30 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
attaching the messed patch given in the description as a file. (patch.diff,810 bytes, patch)
2008-11-15 12:05 UTC, Burak Arslan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Burak Arslan 2008-11-15 12:03:09 UTC
the bug is due to the change explained in the following thread: 
http://archives.postgresql.org/pgsql-hackers/2007-09/msg00933.php

using dev-db/postgresql-server-8.3.4 and dev-db/postgresql-base-8.3.4



Reproducible: Always

Steps to Reproduce:
1.emerge =dev-db/postgis-1.3.3
2.emerge --config postgis
3.
(assuming a working postgresql-server-8.3.x installation)
Actual Results:  
Configuring pkg...

 * Create or upgrade a spatial template and database.
 * Using the user postgres and the template_gis template database.
 * Please do 'export PG_USER=...' to use another user.
 * Please do 'export PGDATABASE=...' to set another template/database
 * name (templates name have to be prefixed with 'template').
 *
 * Please hit ENTER if you want to create the template_gis
 * template database as postgres user, or Control-C to abort now...

ERROR:  VACUUM cannot be executed from a function or multi-command string
 *
 * ERROR: dev-db/postgis-1.3.3 failed.
 * Call stack:
 *               ebuild.sh, line   49:  Called pkg_config
 *             environment, line 2678:  Called die
 * The specific snippet of code:
 *                              VACUUM FREEZE;" || die "Unable to create ${mydb}";
 *  The die message:
 *   Unable to create template_gis
 *
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/dev-db/postgis-1.3.3/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-db/postgis-1.3.3/temp/environment'.
 * This ebuild is from an overlay: '/var/db/pkg/'
 *


Expected Results:  
Configuring pkg...

 * Create or upgrade a spatial template and database.
 * Using the user postgres and the template_gis template database.
 * Please do 'export PG_USER=...' to use another user.
 * Please do 'export PGDATABASE=...' to set another template/database
 * name (templates name have to be prefixed with 'template').
 *
 * Please hit ENTER if you want to upgrade the template_gis
 * template database as postgres user, or Control-C to abort now...

 * Updating the dynamic library references
 * Running soft upgrade

       postgis_major_version_check
------------------------------------------
 Scripts versions checked for upgrade: ok
(1 row)

 * You can now create a spatial database using :
 * 'createdb -T template_gis test'



here's a patch that fixes the problem. it simply separates the vacuum command to be executed by a separate psql client process.

-- /usr/portage/dev-db/postgis/postgis-1.3.3.ebuild    2008-05-21 19:06:55.000000000 +0300
+++ postgis-1.3.3.ebuild        2008-11-15 13:56:02.798131698 +0200
@@ -144,8 +144,8 @@
                        psql -q -U ${myuser} ${mydb} -c \
                                "UPDATE pg_database SET datistemplate = TRUE
                                WHERE datname = '${mydb}';
-                               GRANT ALL ON table spatial_ref_sys, geometry_columns TO PUBLIC;
-                               VACUUM FREEZE;" || die "Unable to create ${mydb}"
+                               GRANT ALL ON table spatial_ref_sys, geometry_columns TO PUBLIC;" || die "Unable to create ${mydb}"
+                       psql -q -U ${myuser} ${mydb} -c "VACUUM FREEZE;"
                fi
        else
                einfo
Comment 1 Burak Arslan 2008-11-15 12:05:22 UTC
Created attachment 171797 [details, diff]
attaching the messed patch given in the description as a file.
Comment 2 FENOY Gérald (RETIRED) gentoo-dev 2009-06-13 20:30:03 UTC
Thanks for your help, your modifications were used in the new 1.3.6 version in the portage tree and also ni the 1.3.3 one.