mirror of https://github.com/postgres/postgres
remove useless files, beat some sense into Makefile. For me it builds and sort of runs, so it's a start.REL7_2_STABLE
parent
bb30d49a2a
commit
c51b00a213
@ -1,69 +1,60 @@ |
||||
# $Header: /cvsroot/pgsql/src/pl/plpython/Makefile,v 1.4 2001/05/12 01:30:30 petere Exp $
|
||||
|
||||
# cflags. pick your favorite
|
||||
#
|
||||
CC=gcc
|
||||
CFLAGS=-g -O0 -Wall -Wmissing-declarations -fPIC
|
||||
subdir = src/pl/plpython
|
||||
top_builddir = ../../..
|
||||
include $(top_builddir)/src/Makefile.global |
||||
|
||||
# build info for python, alter as needed
|
||||
#
|
||||
# These things ought to go into $(top_srcdir)/config/python.m4 sometime.
|
||||
|
||||
# python headers
|
||||
#
|
||||
#INCPYTHON=/usr/include/python1.5
|
||||
INCPYTHON=/usr/include/python2.0
|
||||
PYTHON_VERSION := $(shell $(PYTHON) -c 'import sys; print sys.version[:3]')
|
||||
PYTHON_INCLUDE := $(shell $(PYTHON) -c 'import sys; print sys.prefix')/include/python$(PYTHON_VERSION)
|
||||
|
||||
# python shared library
|
||||
#
|
||||
#LIBPYTHON=python1.5
|
||||
LIBPYTHON=python2.0
|
||||
override CPPFLAGS := -I$(srcdir) -I$(PYTHON_INCLUDE) $(CPPFLAGS) |
||||
|
||||
# if python is someplace odd
|
||||
#
|
||||
LIBPYTHONPATH=/usr/lib
|
||||
PYTHON_LIB := $(shell $(PYTHON) -c 'import sys; print sys.exec_prefix')/lib/python$(PYTHON_VERSION)
|
||||
|
||||
# python 2 seems to want libdb
|
||||
# various db libs are still messed on my system
|
||||
#
|
||||
#LIBPYTHONEXTRA=/usr/lib/libdb2.so.2.7.7
|
||||
#LIBPYTHONEXTRA=-ldb2
|
||||
NAME = plpython
|
||||
SO_MAJOR_VERSION = 0
|
||||
SO_MINOR_VERSION = 0
|
||||
OBJS = plpython.o
|
||||
|
||||
LDPYTHON=-L$(LIBPYTHONPATH) -l$(LIBPYTHON) $(LIBPYTHONEXTRA)
|
||||
# This static version might work on most ELF systems...
|
||||
SHLIB_LINK += $(PYTHON_LIB)/config/libpython$(PYTHON_VERSION).a
|
||||
# ...otherwise you need a shared version, but you need to build that yourself.
|
||||
#SHLIB_LINK += -lpython$(PYTHON_VERSION)
|
||||
|
||||
# build info for postgres
|
||||
#
|
||||
# Python uses this. Should become a configure check.
|
||||
SHLIB_LINK += -lpthread
|
||||
|
||||
# postgres headers. the installed include directory doesn't work for me
|
||||
#
|
||||
#INCPOSTGRES=/usr/include/postgres
|
||||
INCPOSTGRES=/home/andrew/builds/postgresql/src/include
|
||||
# Python 2 seems to want libdb.
|
||||
#SHLIB_LINK += -ldb2
|
||||
|
||||
# hopefully you won't need this utter crap...
|
||||
# but if you can't patch the appropriate dynloader file, try this. you
|
||||
# may have to add other modules.
|
||||
#
|
||||
#DLDIR=/usr/lib/python1.5/lib-dynload
|
||||
#DLHACK=$(DLDIR)/arraymodule.so $(DLDIR)/timemodule.so $(DLDIR)/cmathmodule.so $(DLDIR)/errnomodule.so $(DLDIR)/mathmodule.so $(DLDIR)/md5module.so $(DLDIR)/operator.so
|
||||
# $(DLDIR)/shamodule.so
|
||||
|
||||
# shouldn't need to alter anything below here
|
||||
# Hopefully you won't need this utter crap. But if you can't patch
|
||||
# the appropriate dynloader file, try this. You may have to add other
|
||||
# modules.
|
||||
#
|
||||
INCLUDES=-I$(INCPYTHON) -I$(INCPOSTGRES) -I./
|
||||
#DLDIR=$(PYTHON_LIB)/lib-dynload
|
||||
#DLHACK=$(DLDIR)/arraymodule.so $(DLDIR)/timemodule.so $(DLDIR)/cmathmodule.so $(DLDIR)/errnomodule.so $(DLDIR)/mathmodule.so $(DLDIR)/md5module.so $(DLDIR)/operator.so $(DLDIR)/shamodule.so
|
||||
#SHLIB_LINK += $(DLDIR)
|
||||
|
||||
include $(top_srcdir)/src/Makefile.shlib |
||||
|
||||
# dynamic linker flags.
|
||||
#
|
||||
#LDFLAGS=--shared -Wl,-Bshareable -Wl,-E -Wl,-soname,$@
|
||||
LDFLAGS=--shared -Wl,-E -Wl,-soname,$@
|
||||
|
||||
.PHONY: clean |
||||
all: all-lib |
||||
|
||||
all: plpython.so |
||||
install: all installdirs |
||||
$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(libdir)/plpython$(DLSUFFIX)
|
||||
|
||||
plpython.o: plpython.c plpython.h |
||||
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
|
||||
installdirs: |
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
|
||||
plpython.so: plpython.o |
||||
$(CC) $(LDFLAGS) -o $@ $^ $(LDPYTHON) $(DLHACK) -ldl -lpthread -lm
|
||||
uninstall: |
||||
rm -f $(DESTDIR)$(libdir)/plpython$(DLSUFFIX)
|
||||
|
||||
clean: |
||||
rm -f plpython.so *.o
|
||||
clean distclean maintainer-clean: clean-lib |
||||
rm -f $(OBJS)
|
||||
@rm -f error.diff feature.diff error.output feature.output test.log
|
||||
|
||||
installcheck: |
||||
PATH=$(bindir):$$PATH $(SHELL) $(srcdir)/test.sh
|
||||
|
||||
@ -1,18 +0,0 @@ |
||||
--- error.expected Sat Mar 31 16:15:31 2001
|
||||
+++ error.output Thu Apr 19 23:47:53 2001
|
||||
@@ -1,5 +1,5 @@
|
||||
SELECT invalid_type_uncaught('rick');
|
||||
-ERROR: plpython: Call of function `__plpython_procedure_invalid_type_uncaught_1175341' failed.
|
||||
+ERROR: plpython: Call of function `__plpython_procedure_invalid_type_uncaught_1289666' failed.
|
||||
plpy.SPIError: Cache lookup for type `test' failed.
|
||||
SELECT invalid_type_caught('rick');
|
||||
NOTICE: ("Cache lookup for type `test' failed.",)
|
||||
@@ -9,7 +9,7 @@
|
||||
(1 row)
|
||||
|
||||
SELECT invalid_type_reraised('rick');
|
||||
-ERROR: plpython: Call of function `__plpython_procedure_invalid_type_reraised_1175343' failed.
|
||||
+ERROR: plpython: Call of function `__plpython_procedure_invalid_type_reraised_1289668' failed.
|
||||
plpy.Error: ("Cache lookup for type `test' failed.",)
|
||||
SELECT valid_type('rick');
|
||||
valid_type
|
||||
@ -1,19 +0,0 @@ |
||||
SELECT invalid_type_uncaught('rick'); |
||||
ERROR: plpython: Call of function `__plpython_procedure_invalid_type_uncaught_1289666' failed. |
||||
plpy.SPIError: Cache lookup for type `test' failed. |
||||
SELECT invalid_type_caught('rick'); |
||||
NOTICE: ("Cache lookup for type `test' failed.",) |
||||
invalid_type_caught |
||||
--------------------- |
||||
|
||||
(1 row) |
||||
|
||||
SELECT invalid_type_reraised('rick'); |
||||
ERROR: plpython: Call of function `__plpython_procedure_invalid_type_reraised_1289668' failed. |
||||
plpy.Error: ("Cache lookup for type `test' failed.",) |
||||
SELECT valid_type('rick'); |
||||
valid_type |
||||
------------ |
||||
|
||||
(1 row) |
||||
|
||||
@ -1,11 +0,0 @@ |
||||
--- feature.expected Sat Mar 31 16:15:31 2001
|
||||
+++ feature.output Thu Apr 19 23:47:52 2001
|
||||
@@ -29,7 +29,7 @@
|
||||
(1 row)
|
||||
|
||||
SELECT import_fail();
|
||||
-NOTICE: ('import socket failed -- untrusted dynamic module: socket',)
|
||||
+NOTICE: ('import socket failed -- untrusted dynamic module: _socket',)
|
||||
import_fail
|
||||
--------------------
|
||||
failed as expected
|
||||
@ -1,139 +0,0 @@ |
||||
select stupid(); |
||||
stupid |
||||
-------- |
||||
zarkon |
||||
(1 row) |
||||
|
||||
SELECT static_test(); |
||||
static_test |
||||
------------- |
||||
1 |
||||
(1 row) |
||||
|
||||
SELECT static_test(); |
||||
static_test |
||||
------------- |
||||
2 |
||||
(1 row) |
||||
|
||||
SELECT global_test_one(); |
||||
global_test_one |
||||
-------------------------------------------------------- |
||||
SD: set by global_test_one, GD: set by global_test_one |
||||
(1 row) |
||||
|
||||
SELECT global_test_two(); |
||||
global_test_two |
||||
-------------------------------------------------------- |
||||
SD: set by global_test_two, GD: set by global_test_one |
||||
(1 row) |
||||
|
||||
SELECT import_fail(); |
||||
NOTICE: ('import socket failed -- untrusted dynamic module: _socket',) |
||||
import_fail |
||||
-------------------- |
||||
failed as expected |
||||
(1 row) |
||||
|
||||
SELECT import_succeed(); |
||||
import_succeed |
||||
------------------------ |
||||
succeeded, as expected |
||||
(1 row) |
||||
|
||||
SELECT import_test_one('sha hash of this string'); |
||||
import_test_one |
||||
------------------------------------------ |
||||
a04e23cb9b1a09cd1051a04a7c571aae0f90346c |
||||
(1 row) |
||||
|
||||
select import_test_two(users) from users where fname = 'willem'; |
||||
import_test_two |
||||
------------------------------------------------------------------- |
||||
sha hash of willemdoe is 3cde6b574953b0ca937b4d76ebc40d534d910759 |
||||
(1 row) |
||||
|
||||
select argument_test_one(users, fname, lname) from users where lname = 'doe'; |
||||
argument_test_one |
||||
------------------------------------------------------------------------------------- |
||||
willem doe => {'fname': 'willem', 'userid': 3, 'lname': 'doe', 'username': 'w_doe'} |
||||
john doe => {'fname': 'john', 'userid': 2, 'lname': 'doe', 'username': 'johnd'} |
||||
jane doe => {'fname': 'jane', 'userid': 1, 'lname': 'doe', 'username': 'j_doe'} |
||||
(3 rows) |
||||
|
||||
select nested_call_one('pass this along'); |
||||
nested_call_one |
||||
----------------------------------------------------------------- |
||||
{'nested_call_two': "{'nested_call_three': 'pass this along'}"} |
||||
(1 row) |
||||
|
||||
select spi_prepared_plan_test_one('doe'); |
||||
spi_prepared_plan_test_one |
||||
---------------------------- |
||||
there are 3 does |
||||
(1 row) |
||||
|
||||
select spi_prepared_plan_test_one('smith'); |
||||
spi_prepared_plan_test_one |
||||
---------------------------- |
||||
there are 1 smiths |
||||
(1 row) |
||||
|
||||
select spi_prepared_plan_test_nested('smith'); |
||||
spi_prepared_plan_test_nested |
||||
------------------------------- |
||||
there are 1 smiths |
||||
(1 row) |
||||
|
||||
SELECT * FROM users; |
||||
fname | lname | username | userid |
||||
--------+-------+----------+-------- |
||||
jane | doe | j_doe | 1 |
||||
john | doe | johnd | 2 |
||||
willem | doe | w_doe | 3 |
||||
rick | smith | slash | 4 |
||||
(4 rows) |
||||
|
||||
UPDATE users SET fname = 'william' WHERE fname = 'willem'; |
||||
INSERT INTO users (fname, lname) VALUES ('william', 'smith'); |
||||
INSERT INTO users (fname, lname, username) VALUES ('charles', 'darwin', 'beagle'); |
||||
SELECT * FROM users; |
||||
fname | lname | username | userid |
||||
---------+--------+----------+-------- |
||||
jane | doe | j_doe | 1 |
||||
john | doe | johnd | 2 |
||||
willem | doe | w_doe | 3 |
||||
rick | smith | slash | 4 |
||||
willem | smith | w_smith | 5 |
||||
charles | darwin | beagle | 6 |
||||
(6 rows) |
||||
|
||||
SELECT join_sequences(sequences) FROM sequences; |
||||
join_sequences |
||||
---------------- |
||||
ABCDEFGHIJKL |
||||
ABCDEF |
||||
ABCDEF |
||||
ABCDEF |
||||
ABCDEF |
||||
ABCDEF |
||||
(6 rows) |
||||
|
||||
SELECT join_sequences(sequences) FROM sequences |
||||
WHERE join_sequences(sequences) ~* '^A'; |
||||
join_sequences |
||||
---------------- |
||||
ABCDEFGHIJKL |
||||
ABCDEF |
||||
ABCDEF |
||||
ABCDEF |
||||
ABCDEF |
||||
ABCDEF |
||||
(6 rows) |
||||
|
||||
SELECT join_sequences(sequences) FROM sequences |
||||
WHERE join_sequences(sequences) ~* '^B'; |
||||
join_sequences |
||||
---------------- |
||||
(0 rows) |
||||
|
||||
@ -1,44 +0,0 @@ |
||||
/*-------------------------------------------------------------------------
|
||||
* |
||||
* port_protos.h |
||||
* port-specific prototypes for Linux |
||||
* |
||||
* |
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc |
||||
* Portions Copyright (c) 1994, Regents of the University of California |
||||
* |
||||
* $Id: linux.h,v 1.1 2001/05/09 19:54:38 momjian Exp $ |
||||
* |
||||
*------------------------------------------------------------------------- |
||||
*/ |
||||
#ifndef PORT_PROTOS_H |
||||
#define PORT_PROTOS_H |
||||
|
||||
#include "fmgr.h" |
||||
#include "utils/dynamic_loader.h" |
||||
#ifdef __ELF__ |
||||
#include <dlfcn.h> |
||||
#endif |
||||
|
||||
/* dynloader.c */ |
||||
|
||||
#ifndef __ELF__ |
||||
#ifndef HAVE_DLD_H |
||||
#define pg_dlsym(handle, funcname) (NULL) |
||||
#define pg_dlclose(handle) ({}) |
||||
#else |
||||
#define pg_dlsym(handle, funcname) ((PGFunction) dld_get_func((funcname))) |
||||
#define pg_dlclose(handle) ({ dld_unlink_by_file(handle, 1); free(handle); }) |
||||
#endif |
||||
#else |
||||
/* #define pg_dlopen(f) dlopen(f, 1) */ |
||||
/* #define pg_dlopen(f) dlopen(f, 2) */ |
||||
#define pg_dlopen(f) dlopen(f, (RTLD_NOW|RTLD_GLOBAL)) |
||||
#define pg_dlsym dlsym |
||||
#define pg_dlclose dlclose |
||||
#define pg_dlerror dlerror |
||||
#endif |
||||
|
||||
/* port.c */ |
||||
|
||||
#endif /* PORT_PROTOS_H */ |
||||
@ -1,9 +0,0 @@ |
||||
|
||||
CREATE FUNCTION plpython_call_handler() RETURNS opaque |
||||
AS '/usr/local/lib/postgresql/langs/plpython.so' |
||||
LANGUAGE 'c'; |
||||
|
||||
CREATE TRUSTED PROCEDURAL LANGUAGE 'plpython' |
||||
HANDLER plpython_call_handler |
||||
LANCOMPILER 'plpython'; |
||||
|
||||
@ -1,16 +0,0 @@ |
||||
DROP DATABASE |
||||
CREATE DATABASE |
||||
NOTICE: CREATE TABLE will create implicit sequence 'users_userid_seq' for SERIAL column 'users.userid' |
||||
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'users_userid_key' for table 'users' |
||||
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'users_pkey' for table 'users' |
||||
NOTICE: CREATE TABLE will create implicit sequence 'taxonomy_id_seq' for SERIAL column 'taxonomy.id' |
||||
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'taxonomy_pkey' for table 'taxonomy' |
||||
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'taxonomy_name_key' for table 'taxonomy' |
||||
NOTICE: CREATE TABLE will create implicit sequence 'entry_eid_seq' for SERIAL column 'entry.eid' |
||||
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'entry_pkey' for table 'entry' |
||||
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'entry_eid_key' for table 'entry' |
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
||||
NOTICE: CREATE TABLE will create implicit sequence 'sequences_pid_seq' for SERIAL column 'sequences.pid' |
||||
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'sequences_pkey' for table 'sequences' |
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
||||
@ -1,5 +0,0 @@ |
||||
#!/bin/sh |
||||
|
||||
cd /usr/local/lib/postgresql/langs |
||||
cp /home/andrew/projects/pg/plpython/plpython.so ./ |
||||
cd /home/andrew/projects/pg/plpython |
||||
Loading…
Reference in new issue