summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2000-03-28 02:49:19 +0000
committerTom Lane2000-03-28 02:49:19 +0000
commitd778d226774292823a8cf912ae862b6e30cc4e02 (patch)
treeb1f76657965d519b10bc47c16d5c1928561a79d0
parentc73d8c64b50b864e6128eb9bb99dee33c15680da (diff)
Fix some bogosity in the tutorial examples.
-rw-r--r--src/tutorial/Makefile14
-rw-r--r--src/tutorial/complex.source26
-rw-r--r--src/tutorial/funcs.source8
3 files changed, 20 insertions, 28 deletions
diff --git a/src/tutorial/Makefile b/src/tutorial/Makefile
index 4d7009abd2..b0c93c4906 100644
--- a/src/tutorial/Makefile
+++ b/src/tutorial/Makefile
@@ -9,17 +9,9 @@
#-------------------------------------------------------------------------
SRCDIR= ..
-include ../Makefile.global
+include $(SRCDIR)/Makefile.global
-CFLAGS+= -I$(LIBPQDIR) -I../../include
-
-#
-# And where libpq goes, so goes the authentication stuff...
-#
-ifdef KRBVERS
-LDFLAGS+= $(KRBLIBS)
-CFLAGS+= $(KRBFLAGS)
-endif
+CFLAGS+= -I$(SRCDIR)/include $(CFLAGS_SL)
#
# DLOBJS is the dynamically-loaded object files. The "funcs" queries
@@ -42,7 +34,5 @@ all: $(DLOBJS) $(QUERIES)
-e "s:_DLSUFFIX_:$(DLSUFFIX):g" \
-e "s/_USER_/$$USER/g" < $< > $@
-funcs.sql: $(DLOBJS)
-
clean:
rm -f $(DLOBJS) $(QUERIES)
diff --git a/src/tutorial/complex.source b/src/tutorial/complex.source
index ddbee96144..9f89f5c44c 100644
--- a/src/tutorial/complex.source
+++ b/src/tutorial/complex.source
@@ -18,7 +18,7 @@
-- called 'complex' which represents complex numbers.
-----------------------------
--- Assume the user defined functions are in _OBJWD_/complex.so
+-- Assume the user defined functions are in _OBJWD_/complex_DLSUFFIX_
-- Look at $PWD/complex.c for the source.
-- the input function 'complex_in' takes a null-terminated string (the
@@ -28,7 +28,7 @@
CREATE FUNCTION complex_in(opaque)
RETURNS complex
- AS '_OBJWD_/complex.so'
+ AS '_OBJWD_/complex_DLSUFFIX_'
LANGUAGE 'c';
-- the output function 'complex_out' takes the internal representation and
@@ -36,7 +36,7 @@ CREATE FUNCTION complex_in(opaque)
CREATE FUNCTION complex_out(opaque)
RETURNS opaque
- AS '_OBJWD_/complex.so'
+ AS '_OBJWD_/complex_DLSUFFIX_'
LANGUAGE 'c';
-- now, we can create the type. The internallength specifies the size of the
@@ -80,7 +80,7 @@ SELECT * FROM test_complex;
-- first, define a function complex_add (also in complex.c)
CREATE FUNCTION complex_add(complex, complex)
RETURNS complex
- AS '_OBJWD_/complex.so'
+ AS '_OBJWD_/complex_DLSUFFIX_'
LANGUAGE 'c';
-- we can now define the operator. We show a binary operator here but you
@@ -138,15 +138,15 @@ SELECT 'READ ABOVE!' AS STOP;
-- first, define the required operators
CREATE FUNCTION complex_abs_lt(complex, complex) RETURNS bool
- AS '_OBJWD_/complex.so' LANGUAGE 'c';
+ AS '_OBJWD_/complex_DLSUFFIX_' LANGUAGE 'c';
CREATE FUNCTION complex_abs_le(complex, complex) RETURNS bool
- AS '_OBJWD_/complex.so' LANGUAGE 'c';
+ AS '_OBJWD_/complex_DLSUFFIX_' LANGUAGE 'c';
CREATE FUNCTION complex_abs_eq(complex, complex) RETURNS bool
- AS '_OBJWD_/complex.so' LANGUAGE 'c';
+ AS '_OBJWD_/complex_DLSUFFIX_' LANGUAGE 'c';
CREATE FUNCTION complex_abs_ge(complex, complex) RETURNS bool
- AS '_OBJWD_/complex.so' LANGUAGE 'c';
+ AS '_OBJWD_/complex_DLSUFFIX_' LANGUAGE 'c';
CREATE FUNCTION complex_abs_gt(complex, complex) RETURNS bool
- AS '_OBJWD_/complex.so' LANGUAGE 'c';
+ AS '_OBJWD_/complex_DLSUFFIX_' LANGUAGE 'c';
CREATE OPERATOR < (
leftarg = complex, rightarg = complex, procedure = complex_abs_lt,
@@ -169,9 +169,11 @@ CREATE OPERATOR > (
restrict = scalargtsel, join = scalargtjoinsel
);
-INSERT INTO pg_opclass VALUES ('complex_abs_ops');
+INSERT INTO pg_opclass (opcname, opcdeftype)
+ SELECT 'complex_abs_ops', oid FROM pg_type WHERE typname = 'complex';
-SELECT oid, opcname FROM pg_opclass WHERE opcname = 'complex_abs_ops';
+SELECT oid, opcname, opcdeftype
+ FROM pg_opclass WHERE opcname = 'complex_abs_ops';
SELECT o.oid AS opoid, o.oprname
INTO TABLE complex_ops_tmp
@@ -214,7 +216,7 @@ INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
--
CREATE FUNCTION complex_abs_cmp(complex, complex) RETURNS int4
- AS '_OBJWD_/complex.so' LANGUAGE 'c';
+ AS '_OBJWD_/complex_DLSUFFIX_' LANGUAGE 'c';
SELECT oid, proname FROM pg_proc WHERE proname = 'complex_abs_cmp';
diff --git a/src/tutorial/funcs.source b/src/tutorial/funcs.source
index 5b28f6e356..f29a64ae1d 100644
--- a/src/tutorial/funcs.source
+++ b/src/tutorial/funcs.source
@@ -126,16 +126,16 @@ SELECT name(high_pay()) AS overpaid;
-----------------------------
CREATE FUNCTION add_one(int4) RETURNS int4
- AS '_OBJWD_/funcs.so' LANGUAGE 'c';
+ AS '_OBJWD_/funcs_DLSUFFIX_' LANGUAGE 'c';
CREATE FUNCTION makepoint(point, point) RETURNS point
- AS '_OBJWD_/funcs.so' LANGUAGE 'c';
+ AS '_OBJWD_/funcs_DLSUFFIX_' LANGUAGE 'c';
CREATE FUNCTION copytext(text) RETURNS text
- AS '_OBJWD_/funcs.so' LANGUAGE 'c';
+ AS '_OBJWD_/funcs_DLSUFFIX_' LANGUAGE 'c';
CREATE FUNCTION c_overpaid(EMP, int4) RETURNS bool
- AS '_OBJWD_/funcs.so' LANGUAGE 'c';
+ AS '_OBJWD_/funcs_DLSUFFIX_' LANGUAGE 'c';
SELECT add_one(3) AS four;