Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1f7ba1e

Browse files
committed
Fix some bogosity in the tutorial examples.
1 parent081cba4 commit1f7ba1e

File tree

3 files changed

+23
-31
lines changed

3 files changed

+23
-31
lines changed

‎src/tutorial/Makefile

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,14 @@
44
# Makefile for tutorial
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/tutorial/Makefile,v 1.8 1998/03/01 04:52:55 scrappy Exp $
7+
# $Header: /cvsroot/pgsql/src/tutorial/Makefile,v 1.9 2000/03/28 02:49:19 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

1111
SRCDIR= ..
12-
include../Makefile.global
12+
include$(SRCDIR)/Makefile.global
1313

14-
CFLAGS+= -I$(LIBPQDIR) -I../../include
15-
16-
#
17-
# And where libpq goes, so goes the authentication stuff...
18-
#
19-
ifdefKRBVERS
20-
LDFLAGS+=$(KRBLIBS)
21-
CFLAGS+=$(KRBFLAGS)
22-
endif
14+
CFLAGS+= -I$(SRCDIR)/include$(CFLAGS_SL)
2315

2416
#
2517
# DLOBJS is the dynamically-loaded object files. The "funcs" queries
@@ -42,7 +34,5 @@ all: $(DLOBJS) $(QUERIES)
4234
-e"s:_DLSUFFIX_:$(DLSUFFIX):g"\
4335
-e"s/_USER_/$$USER/g"<$<>$@
4436

45-
funcs.sql:$(DLOBJS)
46-
4737
clean:
4838
rm -f$(DLOBJS)$(QUERIES)

‎src/tutorial/complex.source

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
--
88
-- Copyright (c) 1994, Regents of the University of California
99
--
10-
-- $Id: complex.source,v 1.6 2000/01/24 07:16:48 tgl Exp $
10+
-- $Id: complex.source,v 1.7 2000/03/28 02:49:19 tgl Exp $
1111
--
1212
---------------------------------------------------------------------------
1313

@@ -18,7 +18,7 @@
1818
--called 'complex' which represents complex numbers.
1919
-----------------------------
2020

21-
-- Assume the user defined functions are in _OBJWD_/complex.so
21+
-- Assume the user defined functions are in _OBJWD_/complex_DLSUFFIX_
2222
-- Look at $PWD/complex.c for the source.
2323

2424
-- the input function 'complex_in' takes a null-terminated string (the
@@ -28,15 +28,15 @@
2828

2929
CREATE FUNCTION complex_in(opaque)
3030
RETURNS complex
31-
AS '_OBJWD_/complex.so'
31+
AS '_OBJWD_/complex_DLSUFFIX_'
3232
LANGUAGE 'c';
3333

3434
-- the output function 'complex_out' takes the internal representation and
3535
-- converts it into the textual representation.
3636

3737
CREATE FUNCTION complex_out(opaque)
3838
RETURNS opaque
39-
AS '_OBJWD_/complex.so'
39+
AS '_OBJWD_/complex_DLSUFFIX_'
4040
LANGUAGE 'c';
4141

4242
-- now, we can create the type. The internallength specifies the size of the
@@ -80,7 +80,7 @@ SELECT * FROM test_complex;
8080
-- first, define a function complex_add (also in complex.c)
8181
CREATE FUNCTION complex_add(complex, complex)
8282
RETURNS complex
83-
AS '_OBJWD_/complex.so'
83+
AS '_OBJWD_/complex_DLSUFFIX_'
8484
LANGUAGE 'c';
8585

8686
-- we can now define the operator. We show a binary operator here but you
@@ -138,15 +138,15 @@ SELECT 'READ ABOVE!' AS STOP;
138138

139139
-- first, define the required operators
140140
CREATE FUNCTION complex_abs_lt(complex, complex) RETURNS bool
141-
AS '_OBJWD_/complex.so' LANGUAGE 'c';
141+
AS '_OBJWD_/complex_DLSUFFIX_' LANGUAGE 'c';
142142
CREATE FUNCTION complex_abs_le(complex, complex) RETURNS bool
143-
AS '_OBJWD_/complex.so' LANGUAGE 'c';
143+
AS '_OBJWD_/complex_DLSUFFIX_' LANGUAGE 'c';
144144
CREATE FUNCTION complex_abs_eq(complex, complex) RETURNS bool
145-
AS '_OBJWD_/complex.so' LANGUAGE 'c';
145+
AS '_OBJWD_/complex_DLSUFFIX_' LANGUAGE 'c';
146146
CREATE FUNCTION complex_abs_ge(complex, complex) RETURNS bool
147-
AS '_OBJWD_/complex.so' LANGUAGE 'c';
147+
AS '_OBJWD_/complex_DLSUFFIX_' LANGUAGE 'c';
148148
CREATE FUNCTION complex_abs_gt(complex, complex) RETURNS bool
149-
AS '_OBJWD_/complex.so' LANGUAGE 'c';
149+
AS '_OBJWD_/complex_DLSUFFIX_' LANGUAGE 'c';
150150

151151
CREATE OPERATOR < (
152152
leftarg = complex, rightarg = complex, procedure = complex_abs_lt,
@@ -169,9 +169,11 @@ CREATE OPERATOR > (
169169
restrict = scalargtsel, join = scalargtjoinsel
170170
);
171171

172-
INSERT INTO pg_opclass VALUES ('complex_abs_ops');
172+
INSERT INTO pg_opclass (opcname, opcdeftype)
173+
SELECT 'complex_abs_ops', oid FROM pg_type WHERE typname = 'complex';
173174

174-
SELECT oid, opcname FROM pg_opclass WHERE opcname = 'complex_abs_ops';
175+
SELECT oid, opcname, opcdeftype
176+
FROM pg_opclass WHERE opcname = 'complex_abs_ops';
175177

176178
SELECT o.oid AS opoid, o.oprname
177179
INTO TABLE complex_ops_tmp
@@ -214,7 +216,7 @@ INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
214216

215217
--
216218
CREATE FUNCTION complex_abs_cmp(complex, complex) RETURNS int4
217-
AS '_OBJWD_/complex.so' LANGUAGE 'c';
219+
AS '_OBJWD_/complex_DLSUFFIX_' LANGUAGE 'c';
218220

219221
SELECT oid, proname FROM pg_proc WHERE proname = 'complex_abs_cmp';
220222

‎src/tutorial/funcs.source

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
--
77
-- Copyright (c) 1994-5, Regents of the University of California
88
--
9-
-- $Id: funcs.source,v 1.3 1999/03/14 15:22:15 momjian Exp $
9+
-- $Id: funcs.source,v 1.4 2000/03/28 02:49:19 tgl Exp $
1010
--
1111
---------------------------------------------------------------------------
1212

@@ -126,16 +126,16 @@ SELECT name(high_pay()) AS overpaid;
126126
-----------------------------
127127

128128
CREATE FUNCTION add_one(int4) RETURNS int4
129-
AS '_OBJWD_/funcs.so' LANGUAGE 'c';
129+
AS '_OBJWD_/funcs_DLSUFFIX_' LANGUAGE 'c';
130130

131131
CREATE FUNCTION makepoint(point, point) RETURNS point
132-
AS '_OBJWD_/funcs.so' LANGUAGE 'c';
132+
AS '_OBJWD_/funcs_DLSUFFIX_' LANGUAGE 'c';
133133

134134
CREATE FUNCTION copytext(text) RETURNS text
135-
AS '_OBJWD_/funcs.so' LANGUAGE 'c';
135+
AS '_OBJWD_/funcs_DLSUFFIX_' LANGUAGE 'c';
136136

137137
CREATE FUNCTION c_overpaid(EMP, int4) RETURNS bool
138-
AS '_OBJWD_/funcs.so' LANGUAGE 'c';
138+
AS '_OBJWD_/funcs_DLSUFFIX_' LANGUAGE 'c';
139139

140140
SELECT add_one(3) AS four;
141141

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp