From 74bbe8097dfef33684d9d01b97f5de71dd21e7c9 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 20 Jan 2001 20:59:29 +0000 Subject: [PATCH] Replace some oldish, non-SQL'ish elements with more standard forms. (cast syntax, type names, function names, etc.) --- doc/src/sgml/dfunc.sgml | 8 +- doc/src/sgml/func.sgml | 108 ++++++++++++------------- doc/src/sgml/libpq++.sgml | 4 +- doc/src/sgml/libpq.sgml | 12 ++- doc/src/sgml/odbc.sgml | 10 +-- doc/src/sgml/plsql.sgml | 30 +++---- doc/src/sgml/ref/comment.sgml | 6 +- doc/src/sgml/ref/create_aggregate.sgml | 6 +- doc/src/sgml/rules.sgml | 45 ++++------- doc/src/sgml/typeconv.sgml | 16 ++-- doc/src/sgml/xfunc.sgml | 12 +-- 11 files changed, 119 insertions(+), 138 deletions(-) diff --git a/doc/src/sgml/dfunc.sgml b/doc/src/sgml/dfunc.sgml index aa3fa8bdad..f9e37e1f28 100644 --- a/doc/src/sgml/dfunc.sgml +++ b/doc/src/sgml/dfunc.sgml @@ -1,5 +1,5 @@ @@ -20,7 +20,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.12 2001/01/12 22:15:32 peter In addition, the PostgreSQL source code contains several working examples in the contrib directory. If you rely on these - examples you will make your modules dependent on the documentation + examples you will make your modules dependent on the availability of the PostgreSQL source code, however. @@ -29,8 +29,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.12 2001/01/12 22:15:32 peter executables: first the source files are compiled into object files, then the object files are linked together. The object files need to be created as position-independent code - (PIC), which conceptually means that it can be - placed at an arbitrary location in memory when it is loaded by the + (PIC), which conceptually means that they can be + placed at an arbitrary location in memory when they are loaded by the executable. (Object files intended for executables are not compiled that way.) The command to link a shared library contains special flags to distinguish it from linking an executable. --- At least diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 2c6237ab29..4ea4881f81 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,4 +1,4 @@ - + Functions and Operators @@ -1274,9 +1274,9 @@ to_char(125, '999') - to_char(float, text) + to_char(double precision, text) text - convert float4/float8 to string + convert real/double precision to string to_char(125.8, '999D9') @@ -1927,13 +1927,13 @@ date_part(text,timestamp) - float8 + double precision portion of date date_part('dow',timestamp 'now') date_part(text,interval) - float8 + double precision portion of time date_part('hour',interval '4 hrs 3 mins') @@ -2033,22 +2033,22 @@ + Translation - '((0,0),(1,1))'::box + '(2.0,0)'::point + box '((0,0),(1,1))' + point '(2.0,0)' - Translation - '((0,0),(1,1))'::box - '(2.0,0)'::point + box '((0,0),(1,1))' - point '(2.0,0)' * Scaling/rotation - '((0,0),(1,1))'::box * '(2.0,0)'::point + box '((0,0),(1,1))' * point '(2.0,0)' / Scaling/rotation - '((0,0),(2,2))'::box / '(2.0,0)'::point + box '((0,0),(2,2))' / point '(2.0,0)' # @@ -2063,92 +2063,92 @@ ## Point of closest proximity - '(0,0)'::point ## '((2,0),(0,2))'::lseg + point '(0,0)' ## lseg '((2,0),(0,2))' && Overlaps? - '((0,0),(1,1))'::box && '((0,0),(2,2))'::box + box '((0,0),(1,1))' && box '((0,0),(2,2))' &< Overlaps to left? - '((0,0),(1,1))'::box &< '((0,0),(2,2))'::box + box '((0,0),(1,1))' &< box '((0,0),(2,2))' &> Overlaps to right? - '((0,0),(3,3))'::box &> '((0,0),(2,2))'::box + box '((0,0),(3,3))' &> box '((0,0),(2,2))' <-> Distance between - '((0,0),1)'::circle <-> '((5,0),1)'::circle + circle '((0,0),1)' <-> circle '((5,0),1)' << Left of? - '((0,0),1)'::circle << '((5,0),1)'::circle + circle '((0,0),1)' << circle '((5,0),1)' <^ Is below? - '((0,0),1)'::circle <^ '((0,5),1)'::circle + circle '((0,0),1)' <^ circle '((0,5),1)' >> Is right of? - '((5,0),1)'::circle >> '((0,0),1)'::circle + circle '((5,0),1)' >> circle '((0,0),1)' >^ Is above? - '((0,5),1)'::circle >^ '((0,0),1)'::circle + circle '((0,5),1)' >^ circle '((0,0),1)' ?# Intersects or overlaps - '((-1,0),(1,0))'::lseg ?# '((-2,-2),(2,2))'::box; + lseg '((-1,0),(1,0))' ?# box '((-2,-2),(2,2))'; ?- Is horizontal? - '(1,0)'::point ?- '(0,0)'::point + point '(1,0)' ?- point '(0,0)' ?-| Is perpendicular? - '((0,0),(0,1))'::lseg ?-| '((0,0),(1,0))'::lseg + lseg '((0,0),(0,1))' ?-| lseg '((0,0),(1,0))' @-@ Length or circumference - @-@ '((0,0),(1,0))'::path + @-@ path '((0,0),(1,0))' ?| Is vertical? - '(0,1)'::point ?| '(0,0)'::point + point '(0,1)' ?| point '(0,0)' ?|| Is parallel? - '((-1,0),(1,0))'::lseg ?|| '((-1,2),(1,2))'::lseg + lseg '((-1,0),(1,0))' ?|| lseg '((-1,2),(1,2))' @ Contained or on - '(1,1)'::point @ '((0,0),2)'::circle + point '(1,1)' @ circle '((0,0),2)' @@ Center of - @@ '((0,0),10)'::circle + @@ circle '((0,0),10)' ~= Same as - '((0,0),(1,1))'::polygon ~= '((1,1),(0,0))'::polygon + polygon '((0,0),(1,1))' ~= polygon '((1,1),(0,0))' @@ -2168,12 +2168,12 @@ area(object) - float8 + double precision area of item area(box '((0,0),(1,1))') - box(box,box) + box(box, box) box intersection box box(box '((0,0),(1,1))',box '((0.5,0.5),(2,2))') @@ -2186,13 +2186,13 @@ diameter(circle) - float8 + double precision diameter of circle diameter(circle '((0,0),2.0)') height(box) - float8 + double precision vertical size of box height(box '((0,0),(1,1))') @@ -2210,7 +2210,7 @@ length(object) - float8 + double precision length of item length(path '((-1,0),(1,0))') @@ -2243,13 +2243,13 @@ Not defined by this name. Implements the intersection operator '#' radius(circle) - float8 + double precision radius of circle radius(circle '((0,0),2.0)') width(box) - float8 + double precision horizontal size width(box '((0,0),(1,1))') @@ -2274,91 +2274,91 @@ Not defined by this name. Implements the intersection operator '#' box(circle) box circle to box - box('((0,0),2.0)'::circle) + box(circle '((0,0),2.0)') - box(point,point) + box(point, point) box points to box - box('(0,0)'::point,'(1,1)'::point) + box(point '(0,0)', point '(1,1)') box(polygon) box polygon to box - box('((0,0),(1,1),(2,0))'::polygon) + box(polygon '((0,0),(1,1),(2,0))') circle(box) circle to circle - circle('((0,0),(1,1))'::box) + circle(box '((0,0),(1,1))') - circle(point,float8) + circle(point, double precision) circle point to circle - circle('(0,0)'::point,2.0) + circle(point '(0,0)', 2.0) lseg(box) lseg box diagonal to lseg - lseg('((-1,0),(1,0))'::box) + lseg(box '((-1,0),(1,0))') - lseg(point,point) + lseg(point, point) lseg points to lseg - lseg('(-1,0)'::point,'(1,0)'::point) + lseg(point '(-1,0)', point '(1,0)') path(polygon) point polygon to path - path('((0,0),(1,1),(2,0))'::polygon) + path(polygon '((0,0),(1,1),(2,0))') point(circle) point center - point('((0,0),2.0)'::circle) + point(circle '((0,0),2.0)') - point(lseg,lseg) + point(lseg, lseg) point intersection - point('((-1,0),(1,0))'::lseg, '((-2,-2),(2,2))'::lseg) + point(lseg '((-1,0),(1,0))', lseg '((-2,-2),(2,2))') point(polygon) point center - point('((0,0),(1,1),(2,0))'::polygon) + point(polygon '((0,0),(1,1),(2,0))') polygon(box) polygon 12 point polygon - polygon('((0,0),(1,1))'::box) + polygon(box '((0,0),(1,1))') polygon(circle) polygon 12-point polygon - polygon('((0,0),2.0)'::circle) + polygon(circle '((0,0),2.0)') - polygon(npts,circle) + polygon(npts, circle) polygon npts polygon - polygon(12,'((0,0),2.0)'::circle) + polygon(12, circle '((0,0),2.0)') polygon(path) polygon path to polygon - polygon('((0,0),(1,1),(2,0))'::path) + polygon(path '((0,0),(1,1),(2,0))') diff --git a/doc/src/sgml/libpq++.sgml b/doc/src/sgml/libpq++.sgml index c1ae073465..38a02104aa 100644 --- a/doc/src/sgml/libpq++.sgml +++ b/doc/src/sgml/libpq++.sgml @@ -1,5 +1,5 @@ @@ -735,7 +735,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/libpq++.sgml,v 1.23 2001/01/13 23:58: PgDatabase data; -data.Exec("create table foo (a int4, b char(16), d float8)"); +data.Exec("create table foo (a int4, b char(16), d double precision)"); data.Exec("copy foo from stdin"); data.PutLine("3\tHello World\t4.5\n"); data.PutLine("4\tGoodbye World\t7.11\n"); diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index a3d3a1a14a..13b69533d2 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,5 +1,5 @@ @@ -1685,7 +1685,7 @@ int PQendcopy(PGconn *conn); As an example: -PQexec(conn, "create table foo (a int4, b char(16), d float8)"); +PQexec(conn, "create table foo (a int4, b char(16), d double precision)"); PQexec(conn, "copy foo from stdin"); PQputline(conn, "3\thello world\t4.5\n"); PQputline(conn,"4\tgoodbye world\t7.11\n"); @@ -2226,13 +2226,11 @@ main() * * populate a database by doing the following: * - * CREATE TABLE test1 (i int4, d float4, p polygon); + * CREATE TABLE test1 (i int4, d real, p polygon); * - * INSERT INTO test1 values (1, 3.567, '(3.0, 4.0, 1.0, - * 2.0)'::polygon); + * INSERT INTO test1 values (1, 3.567, polygon '(3.0, 4.0, 1.0, 2.0)'); * - * INSERT INTO test1 values (2, 89.05, '(4.0, 3.0, 2.0, - * 1.0)'::polygon); + * INSERT INTO test1 values (2, 89.05, polygon '(4.0, 3.0, 2.0, 1.0)'); * * the expected output is: * diff --git a/doc/src/sgml/odbc.sgml b/doc/src/sgml/odbc.sgml index 9acb962a18..fb732c70b7 100644 --- a/doc/src/sgml/odbc.sgml +++ b/doc/src/sgml/odbc.sgml @@ -1,5 +1,5 @@ @@ -290,14 +290,6 @@ InstallDir = /opt/applix/axdata/axshlib - diff --git a/doc/src/sgml/plsql.sgml b/doc/src/sgml/plsql.sgml index 28cc25edaa..def5e07f08 100644 --- a/doc/src/sgml/plsql.sgml +++ b/doc/src/sgml/plsql.sgml @@ -1,5 +1,5 @@ @@ -170,9 +170,9 @@ END; must also have a default value specified. - The default value is evaluated ever time the function is called. So + The default value is evaluated every time the function is called. So assigning 'now' to a variable of type - datetime causes the variable to have the + timestamp causes the variable to have the time of the actual function call, not when the function was precompiled into its bytecode. @@ -322,7 +322,7 @@ RENAME oldname TO newname; All expressions used in PL/pgSQL statements are processed using the backend's executor. Expressions that appear to contain constants may in fact require run-time evaluation (e.g. 'now' for the - datetime type) so + timestamp type) so it is impossible for the PL/pgSQL parser to identify real constant values other than the NULL keyword. All expressions are evaluated internally by executing a query @@ -343,7 +343,7 @@ RENAME oldname TO newname; is a difference between what the two functions -CREATE FUNCTION logfunc1 (text) RETURNS datetime AS ' +CREATE FUNCTION logfunc1 (text) RETURNS timestamp AS ' DECLARE logtxt ALIAS FOR $1; BEGIN @@ -356,10 +356,10 @@ CREATE FUNCTION logfunc1 (text) RETURNS datetime AS ' and -CREATE FUNCTION logfunc2 (text) RETURNS datetime AS ' +CREATE FUNCTION logfunc2 (text) RETURNS timestamp AS ' DECLARE logtxt ALIAS FOR $1; - curtime datetime; + curtime timestamp; BEGIN curtime := ''now''; INSERT INTO logtable VALUES (logtxt, curtime); @@ -371,7 +371,7 @@ CREATE FUNCTION logfunc2 (text) RETURNS datetime AS ' do. In the case of logfunc1(), the Postgres main parser knows when preparing the plan for the INSERT, that the string 'now' - should be interpreted as datetime because the target field of logtable + should be interpreted as timestamp because the target field of logtable is of that type. Thus, it will make a constant from it at this time and this constant value is then used in all invocations of logfunc1() during the lifetime of the backend. Needless to say that this isn't what the @@ -383,7 +383,7 @@ CREATE FUNCTION logfunc2 (text) RETURNS datetime AS ' what type 'now' should become and therefore it returns a data type of text containing the string 'now'. During the assignment to the local variable curtime, the PL/pgSQL interpreter casts this - string to the datetime type by calling the text_out() and datetime_in() + string to the timestamp type by calling the text_out() and timestamp_in() functions for the conversion. @@ -855,7 +855,7 @@ EXIT [ label ] [ WHEN expression -CREATE FUNCTION add_one (int4) RETURNS int4 AS ' +CREATE FUNCTION add_one (integer) RETURNS integer AS ' BEGIN RETURN $1 + 1; END; @@ -881,7 +881,7 @@ CREATE FUNCTION concat_text (text, text) RETURNS text AS ' The C functions. -CREATE FUNCTION c_overpaid (EMP, int4) RETURNS bool AS ' +CREATE FUNCTION c_overpaid (EMP, integer) RETURNS bool AS ' DECLARE emprec ALIAS FOR $1; sallim ALIAS FOR $2; @@ -909,9 +909,9 @@ CREATE FUNCTION c_overpaid (EMP, int4) RETURNS bool AS ' CREATE TABLE emp ( empname text, - salary int4, - last_date datetime, - last_user name); + salary integer, + last_date timestamp, + last_user text); CREATE FUNCTION emp_stamp () RETURNS OPAQUE AS ' BEGIN @@ -930,7 +930,7 @@ CREATE FUNCTION emp_stamp () RETURNS OPAQUE AS ' -- Remember who changed the payroll when NEW.last_date := ''now''; - NEW.last_user := getpgusername(); + NEW.last_user := current_user; RETURN NEW; END; ' LANGUAGE 'plpgsql'; diff --git a/doc/src/sgml/ref/comment.sgml b/doc/src/sgml/ref/comment.sgml index 077d424c05..9597a88975 100644 --- a/doc/src/sgml/ref/comment.sgml +++ b/doc/src/sgml/ref/comment.sgml @@ -1,5 +1,5 @@ @@ -131,8 +131,8 @@ COMMENT ON TABLE my_table IS 'Employee Information'; COMMENT ON TYPE my_type IS 'Complex Number support'; COMMENT ON VIEW my_view IS 'View of departmental costs'; COMMENT ON COLUMN my_table.my_field IS 'Employee ID number'; -COMMENT ON AGGREGATE my_aggregate float8 IS 'Computes sample variance'; -COMMENT ON FUNCTION my_function (datetime) IS 'Returns Roman Numeral'; +COMMENT ON AGGREGATE my_aggregate (double precision) IS 'Computes sample variance'; +COMMENT ON FUNCTION my_function (timestamp) IS 'Returns Roman Numeral'; COMMENT ON OPERATOR ^ (text, text) IS 'Performs intersection of two text'; COMMENT ON TRIGGER my_trigger ON my_table IS 'Used for R.I.'; diff --git a/doc/src/sgml/ref/create_aggregate.sgml b/doc/src/sgml/ref/create_aggregate.sgml index 16d2e5b824..07546a0732 100644 --- a/doc/src/sgml/ref/create_aggregate.sgml +++ b/doc/src/sgml/ref/create_aggregate.sgml @@ -1,5 +1,5 @@ @@ -159,8 +159,8 @@ CREATE CREATE AGGREGATE allows a user or programmer to extend Postgres functionality by defining new aggregate functions. Some aggregate functions - for base types such as min(int4) - and avg(float8) are already provided in the base + for base types such as min(integer) + and avg(double precision) are already provided in the base distribution. If one defines new types or needs an aggregate function not already provided, then CREATE AGGREGATE can be used to provide the desired features. diff --git a/doc/src/sgml/rules.sgml b/doc/src/sgml/rules.sgml index 0e119f7d66..87802323c2 100644 --- a/doc/src/sgml/rules.sgml +++ b/doc/src/sgml/rules.sgml @@ -1053,8 +1053,8 @@ CREATE TABLE shoelace_log ( sl_name char(10), -- shoelace changed sl_avail integer, -- new available value - log_who name, -- who did it - log_when datetime -- when + log_who text, -- who did it + log_when timestamp -- when ); CREATE RULE log_shoelace AS ON UPDATE TO shoelace_data @@ -1062,21 +1062,10 @@ DO INSERT INTO shoelace_log VALUES ( NEW.sl_name, NEW.sl_avail, - getpgusername(), - 'now'::text + current_user, + current_timestamp ); - - One interesting detail is the casting of 'now' in the rules - INSERT action to type text. Without that, the parser would see - at CREATE RULE time, that the target type in shoelace_log - is a datetime and tries to make a constant from it - with success. - So a constant datetime value would be stored in the rule action - and all log entries would have the time of the CREATE RULE statement. - Not exactly what we want. The casting causes the parser to - construct a datetime('now'::text) expression and this will be - evaluated when the rule is executed. (Another way to do this is to - use the function now() instead of a literal constant.) @@ -1120,7 +1109,7 @@ INSERT INTO shoelace_log VALUES( *NEW*.sl_name, *NEW*.sl_avail, - getpgusername(), datetime('now'::text)) + current_user, current_timestamp FROM shoelace_data *NEW*, shoelace_data *OLD*; @@ -1140,7 +1129,7 @@ INSERT INTO shoelace_log VALUES( *NEW*.sl_name, *NEW*.sl_avail, - getpgusername(), datetime('now'::text)) + current_user, current_timestamp FROM shoelace_data *NEW*, shoelace_data *OLD*, shoelace_data shoelace_data; @@ -1151,7 +1140,7 @@ INSERT INTO shoelace_log VALUES( *NEW*.sl_name, *NEW*.sl_avail, - getpgusername(), datetime('now'::text)) + current_user, current_timestamp FROM shoelace_data *NEW*, shoelace_data *OLD*, shoelace_data shoelace_data WHERE int4ne(*NEW*.sl_avail, *OLD*.sl_avail); @@ -1169,7 +1158,7 @@ INSERT INTO shoelace_log VALUES( *NEW*.sl_name, *NEW*.sl_avail, - getpgusername(), datetime('now'::text)) + current_user, current_timestamp FROM shoelace_data *NEW*, shoelace_data *OLD*, shoelace_data shoelace_data WHERE int4ne(*NEW*.sl_avail, *OLD*.sl_avail) @@ -1183,7 +1172,7 @@ INSERT INTO shoelace_log VALUES( shoelace_data.sl_name, 6, - getpgusername(), datetime('now'::text)) + current_user, current_timestamp FROM shoelace_data *NEW*, shoelace_data *OLD*, shoelace_data shoelace_data WHERE int4ne(6, *OLD*.sl_avail) @@ -1195,7 +1184,7 @@ INSERT INTO shoelace_log VALUES( shoelace_data.sl_name, 6, - getpgusername(), datetime('now'::text)) + current_user, current_timestamp FROM shoelace_data *NEW*, shoelace_data *OLD*, shoelace_data shoelace_data WHERE int4ne(6, shoelace_data.sl_avail) @@ -1209,7 +1198,7 @@ INSERT INTO shoelace_log VALUES( shoelace_data.sl_name, 6, - getpgusername(), datetime('now'::text)) + current_user, current_timestamp FROM shoelace_data WHERE 6 != shoelace_data.sl_avail AND shoelace_data.sl_name = 'sl7'; @@ -1235,7 +1224,7 @@ INSERT INTO shoelace_log VALUES( shoelace_data.sl_name, shoelace_data.sl_avail, - getpgusername(), 'now') + current_user, current_timestamp) FROM shoelace_data WHERE shoelace_data.sl_avail != shoelace_data.sl_avail AND shoelace_data.sl_name = 'sl7'; @@ -1258,7 +1247,7 @@ INSERT INTO shoelace_log SELECT shoelace_data.sl_name, 0, - getpgusername(), 'now' + current_user, current_timestamp FROM shoelace_data WHERE 0 != shoelace_data.sl_avail AND shoelace_data.sl_color = 'black'; @@ -1512,8 +1501,8 @@ INSERT INTO shoelace_log SELECT s.sl_name, int4pl(s.sl_avail, shoelace_arrive.arr_quant), - getpgusername(), - datetime('now'::text) + current_user, + current_timestamp FROM shoelace_arrive shoelace_arrive, shoelace_ok shoelace_ok, shoelace_ok *OLD*, shoelace_ok *NEW*, shoelace shoelace, shoelace *OLD*, @@ -1537,8 +1526,8 @@ INSERT INTO shoelace_log SELECT s.sl_name, s.sl_avail + shoelace_arrive.arr_quant, - getpgusername(), - 'now' + current_user, + current_timestamp FROM shoelace_arrive shoelace_arrive, shoelace_data shoelace_data, shoelace_data s WHERE s.sl_name = shoelace_arrive.arr_name diff --git a/doc/src/sgml/typeconv.sgml b/doc/src/sgml/typeconv.sgml index 4c9930622e..0bf7fe8967 100644 --- a/doc/src/sgml/typeconv.sgml +++ b/doc/src/sgml/typeconv.sgml @@ -307,7 +307,8 @@ then fail. There is only one exponentiation -operator defined in the catalog, and it takes float8 arguments. +operator defined in the catalog, and it takes arguments of type +double precision. The scanner assigns an initial type of int4 to both arguments of this query expression: @@ -322,7 +323,7 @@ So the parser does a type conversion on both operands and the query is equivalent to -tgl=> select float8(2) ^ float8(3) AS "Exp"; +tgl=> select CAST(2 AS double precision) ^ CAST(3 AS double precision) AS "Exp"; Exp ----- 8 @@ -754,8 +755,8 @@ Here, the unknown-type literal 'b' will be resolved as type text. -tgl=> SELECT 1.2 AS "Float8" UNION SELECT 1; - Float8 +tgl=> SELECT 1.2 AS "Double" UNION SELECT 1; + Double -------- 1 1.2 @@ -773,7 +774,7 @@ the first/top clause in the union: tgl=> SELECT 1 AS "All integers" -tgl-> UNION SELECT '2.2'::float4; +tgl-> UNION SELECT CAST('2.2' AS REAL); All integers -------------- 1 @@ -782,8 +783,9 @@ tgl-> UNION SELECT '2.2'::float4; -Since float4 is not a preferred type, the parser sees no reason to select it -over int4, and instead falls back on the use-the-first-alternative rule. +Since REAL is not a preferred type, the parser sees no reason +to select it over INTEGER (which is what the 1 is), and instead +falls back on the use-the-first-alternative rule. This example demonstrates that the preferred-type mechanism doesn't encode as much information as we'd like. Future versions of Postgres may support a more general notion of diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index 912107bb66..cafaf47b4e 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -1,5 +1,5 @@ @@ -186,7 +186,7 @@ CREATE FUNCTION double_salary(EMP) SELECT name, double_salary(EMP) AS dream FROM EMP - WHERE EMP.cubicle ~= '(2,1)'::point; + WHERE EMP.cubicle ~= point '(2,1)'; +-----+-------+ @@ -231,10 +231,10 @@ SELECT name(EMP) AS youngster CREATE FUNCTION new_emp() RETURNS EMP - AS 'SELECT \'None\'::text AS name, + AS 'SELECT text ''None'' AS name, 1000 AS salary, 25 AS age, - \'(2,2)\'::point AS cubicle' + point ''(2,2)'' AS cubicle' LANGUAGE 'sql'; @@ -255,7 +255,7 @@ CREATE FUNCTION new_emp() - You must typecast the expressions (using ::) to match the + You must typecast the expressions to match the composite type's definition, or you will get errors like this: @@ -1186,7 +1186,7 @@ LANGUAGE 'c'; - Compiling and loading your object code so that + Compiling and linking your object code so that it can be dynamically loaded into Postgres always requires special flags. -- 2.40.0