mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
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 ...
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user