Skytools 2.x patch for Postgresql 9.3.5

Skytools 2.x compiles perfectly with Postgresql 9.3.5, but when you try to ‘install’ the ticker with the pgqadm.py command, you will receive a strange error.
After searching around on the Internet, it seems that when you compile software with Postgresql 9.3.5, you will need to add an extra library when using ”GETSTRUCT”.

The error message:

2014-11-11 13:38:00,236 15973 INFO plpgsql is installed
2014-11-11 13:38:00,237 15973 INFO txid_current_snapshot is installed
2014-11-11 13:38:00,237 15973 INFO Installing pgq
2014-11-11 13:38:00,238 15973 INFO   Reading from /opt/skytools-2.1.13/share/skytools/pgq.sql
2014-11-11 13:38:00,852 15973 CRITICAL Job live_master_db crashed: : 'could not load library "/opt/postgres_9.3.5/lib/pgq_triggers.so": /opt/postgres_9.3.5/lib/pgq_triggers.so: undefined symbol: GETSTRUCT' (: ['  File "/opt/skytools-2.1.13/lib/python2.6/site-packages/skytools/scripting.py", line 507, in run_once\n    return self.work()\n', '  File "/opt/skytools-2.1.13/bin/pgqadm.py", line 94, in installer\n    skytools.db_install(curs, objs, self.log)\n', '  File "/opt/skytools-2.1.13/lib/python2.6/site-packages/skytools/sqltools.py", line 389, in db_install\n    obj.create(curs, log)\n', '  File "/opt/skytools-2.1.13/lib/python2.6/site-packages/skytools/sqltools.py", line 342, in create\n    curs.execute(sql)\n', '  File "/usr/lib/python2.6/dist-packages/psycopg2/extras.py", line 118, in execute\n    return _cursor.execute(self, query, vars)\n'])

The fix:
Add to ”sql/pgq/triggers/common.c” (in the skytools 2.1.13 source directory) the following line:

#include "access/htup_details.h"

My version now looks like:

/*
 * common.c - functions used by all trigger variants.
 *
 * Copyright (c) 2007 Marko Kreen, Skype Technologies O<C3><9C>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <postgres.h>

#include <commands/trigger.h>
#include <catalog/pg_type.h>
#include <catalog/pg_namespace.h>
#include <executor/spi.h>
#include <lib/stringinfo.h>
#include <utils/builtins.h>
#include <utils/memutils.h>
#include <utils/inval.h>
#include <utils/hsearch.h>
#include <utils/syscache.h>
#include <utils/rel.h>
#include "common.h"
#include "stringutil.h"
#include "access/htup_details.h"

When compiling skytools 2.1.13 with this fix, it will afterwards successfully execute all ”install’ commands.

2014-11-11 14:04:31,905 27818 INFO plpgsql is installed
2014-11-11 14:04:31,907 27818 INFO txid_current_snapshot is installed
2014-11-11 14:04:31,907 27818 INFO Installing pgq
2014-11-11 14:04:31,907 27818 INFO   Reading from /opt/skytools-2.1.13/share/skytools/pgq.sql

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.