aboutsummaryrefslogtreecommitdiff
path: root/src/tutorial/complex.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-08-22 00:01:51 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-08-22 00:01:51 +0000
commitb663f3443ba096a06970214c3e83e79f6e570b84 (patch)
tree049e26c1b02535c12bee6e60ba89cf1d42a41a72 /src/tutorial/complex.c
parent606c9b9d4fafe9300d039c044edc9727c0ed43c9 (diff)
downloadpostgresql-b663f3443ba096a06970214c3e83e79f6e570b84.tar.gz
postgresql-b663f3443ba096a06970214c3e83e79f6e570b84.zip
Add a bunch of pseudo-types to replace the behavior formerly associated
with OPAQUE, as per recent pghackers discussion. I still want to do some more work on the 'cstring' pseudo-type, but I'm going to commit the bulk of the changes now before the tree starts shifting under me ...
Diffstat (limited to 'src/tutorial/complex.c')
-rw-r--r--src/tutorial/complex.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/tutorial/complex.c b/src/tutorial/complex.c
index 2dd4e6e6078..b95baa2be0e 100644
--- a/src/tutorial/complex.c
+++ b/src/tutorial/complex.c
@@ -48,14 +48,6 @@ complex_in(char *str)
return result;
}
-/*
- * You might have noticed a slight inconsistency between the following
- * declaration and the SQL definition:
- * CREATE FUNCTION complex_out(opaque) RETURNS opaque ...
- * The reason is that the argument pass into complex_out is really just a
- * pointer. POSTGRES thinks all output functions are:
- * char *out_func(char *);
- */
char *
complex_out(Complex * complex)
{
@@ -64,8 +56,8 @@ complex_out(Complex * complex)
if (complex == NULL)
return NULL;
- result = (char *) palloc(60);
- sprintf(result, "(%g,%g)", complex->x, complex->y);
+ result = (char *) palloc(100);
+ snprintf(result, 100, "(%g,%g)", complex->x, complex->y);
return result;
}