PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pseudotypes.c File Reference
#include "postgres.h"
#include "libpq/pqformat.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/rangetypes.h"
Include dependency graph for pseudotypes.c:

Go to the source code of this file.

Macros

#define PSEUDOTYPE_DUMMY_IO_FUNCS(typname)
 

Functions

Datum cstring_in (PG_FUNCTION_ARGS)
 
Datum cstring_out (PG_FUNCTION_ARGS)
 
Datum cstring_recv (PG_FUNCTION_ARGS)
 
Datum cstring_send (PG_FUNCTION_ARGS)
 
Datum anyarray_in (PG_FUNCTION_ARGS)
 
Datum anyarray_out (PG_FUNCTION_ARGS)
 
Datum anyarray_recv (PG_FUNCTION_ARGS)
 
Datum anyarray_send (PG_FUNCTION_ARGS)
 
Datum anyenum_in (PG_FUNCTION_ARGS)
 
Datum anyenum_out (PG_FUNCTION_ARGS)
 
Datum anyrange_in (PG_FUNCTION_ARGS)
 
Datum anyrange_out (PG_FUNCTION_ARGS)
 
Datum void_in (PG_FUNCTION_ARGS)
 
Datum void_out (PG_FUNCTION_ARGS)
 
Datum void_recv (PG_FUNCTION_ARGS)
 
Datum void_send (PG_FUNCTION_ARGS)
 
Datum shell_in (PG_FUNCTION_ARGS)
 
Datum shell_out (PG_FUNCTION_ARGS)
 
Datum pg_node_tree_in (PG_FUNCTION_ARGS)
 
Datum pg_node_tree_out (PG_FUNCTION_ARGS)
 
Datum pg_node_tree_recv (PG_FUNCTION_ARGS)
 
Datum pg_node_tree_send (PG_FUNCTION_ARGS)
 
Datum pg_ddl_command_in (PG_FUNCTION_ARGS)
 
Datum pg_ddl_command_out (PG_FUNCTION_ARGS)
 
Datum pg_ddl_command_recv (PG_FUNCTION_ARGS)
 
Datum pg_ddl_command_send (PG_FUNCTION_ARGS)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (any)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (trigger)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (event_trigger)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (language_handler)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (fdw_handler)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (index_am_handler)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (tsm_handler)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (internal)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (opaque)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (anyelement)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (anynonarray)
 

Macro Definition Documentation

#define PSEUDOTYPE_DUMMY_IO_FUNCS (   typname)
Value:
\
Datum \
typname##_in(PG_FUNCTION_ARGS) \
{ \
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), \
errmsg("cannot accept a value of type %s", #typname))); \
PG_RETURN_VOID(); /* keep compiler quiet */ \
} \
\
Datum \
typname##_out(PG_FUNCTION_ARGS) \
{ \
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), \
errmsg("cannot display a value of type %s", #typname))); \
PG_RETURN_VOID(); /* keep compiler quiet */ \
} \
\
extern int no_such_variable
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define PG_FUNCTION_ARGS
Definition: fmgr.h:158

Definition at line 386 of file pseudotypes.c.

Function Documentation

Datum anyarray_in ( PG_FUNCTION_ARGS  )

Definition at line 90 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

91 {
92  ereport(ERROR,
93  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
94  errmsg("cannot accept a value of type %s", "anyarray")));
95 
96  PG_RETURN_VOID(); /* keep compiler quiet */
97 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
Datum anyarray_out ( PG_FUNCTION_ARGS  )

Definition at line 105 of file pseudotypes.c.

References array_out().

106 {
107  return array_out(fcinfo);
108 }
Datum array_out(PG_FUNCTION_ARGS)
Definition: arrayfuncs.c:1011
Datum anyarray_recv ( PG_FUNCTION_ARGS  )

Definition at line 118 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

119 {
120  ereport(ERROR,
121  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
122  errmsg("cannot accept a value of type %s", "anyarray")));
123 
124  PG_RETURN_VOID(); /* keep compiler quiet */
125 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
Datum anyarray_send ( PG_FUNCTION_ARGS  )

Definition at line 133 of file pseudotypes.c.

References array_send().

134 {
135  return array_send(fcinfo);
136 }
Datum array_send(PG_FUNCTION_ARGS)
Definition: arrayfuncs.c:1534
Datum anyenum_in ( PG_FUNCTION_ARGS  )

Definition at line 143 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

144 {
145  ereport(ERROR,
146  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
147  errmsg("cannot accept a value of type %s", "anyenum")));
148 
149  PG_RETURN_VOID(); /* keep compiler quiet */
150 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
Datum anyenum_out ( PG_FUNCTION_ARGS  )

Definition at line 158 of file pseudotypes.c.

References enum_out().

159 {
160  return enum_out(fcinfo);
161 }
Datum enum_out(PG_FUNCTION_ARGS)
Definition: enum.c:165
Datum anyrange_in ( PG_FUNCTION_ARGS  )

Definition at line 167 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

168 {
169  ereport(ERROR,
170  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
171  errmsg("cannot accept a value of type %s", "anyrange")));
172 
173  PG_RETURN_VOID(); /* keep compiler quiet */
174 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
Datum anyrange_out ( PG_FUNCTION_ARGS  )

Definition at line 182 of file pseudotypes.c.

References range_out().

183 {
184  return range_out(fcinfo);
185 }
Datum range_out(PG_FUNCTION_ARGS)
Definition: rangetypes.c:122
Datum cstring_in ( PG_FUNCTION_ARGS  )

Definition at line 37 of file pseudotypes.c.

References PG_GETARG_CSTRING, PG_RETURN_CSTRING, and pstrdup().

38 {
39  char *str = PG_GETARG_CSTRING(0);
40 
42 }
char * pstrdup(const char *in)
Definition: mcxt.c:1077
#define PG_RETURN_CSTRING(x)
Definition: fmgr.h:322
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:242
Datum cstring_out ( PG_FUNCTION_ARGS  )

Definition at line 51 of file pseudotypes.c.

References PG_GETARG_CSTRING, PG_RETURN_CSTRING, and pstrdup().

52 {
53  char *str = PG_GETARG_CSTRING(0);
54 
56 }
char * pstrdup(const char *in)
Definition: mcxt.c:1077
#define PG_RETURN_CSTRING(x)
Definition: fmgr.h:322
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:242
Datum cstring_recv ( PG_FUNCTION_ARGS  )

Definition at line 62 of file pseudotypes.c.

References buf, StringInfoData::cursor, StringInfoData::len, PG_GETARG_POINTER, PG_RETURN_CSTRING, and pq_getmsgtext().

63 {
65  char *str;
66  int nbytes;
67 
68  str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes);
69  PG_RETURN_CSTRING(str);
70 }
StringInfoData * StringInfo
Definition: stringinfo.h:46
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
static char * buf
Definition: pg_test_fsync.c:65
char * pq_getmsgtext(StringInfo msg, int rawbytes, int *nbytes)
Definition: pqformat.c:588
#define PG_RETURN_CSTRING(x)
Definition: fmgr.h:322
Datum cstring_send ( PG_FUNCTION_ARGS  )

Definition at line 76 of file pseudotypes.c.

References buf, PG_GETARG_CSTRING, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), and pq_sendtext().

77 {
78  char *str = PG_GETARG_CSTRING(0);
80 
81  pq_begintypsend(&buf);
82  pq_sendtext(&buf, str, strlen(str));
84 }
void pq_begintypsend(StringInfo buf)
Definition: pqformat.c:359
void pq_sendtext(StringInfo buf, const char *str, int slen)
Definition: pqformat.c:163
#define PG_RETURN_BYTEA_P(x)
Definition: fmgr.h:329
bytea * pq_endtypsend(StringInfo buf)
Definition: pqformat.c:379
static char * buf
Definition: pg_test_fsync.c:65
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:242
Datum pg_ddl_command_in ( PG_FUNCTION_ARGS  )

Definition at line 328 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

329 {
330  /*
331  * Disallow input of pg_ddl_command value.
332  */
333  ereport(ERROR,
334  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
335  errmsg("cannot accept a value of type %s", "pg_ddl_command")));
336 
337  PG_RETURN_VOID(); /* keep compiler quiet */
338 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
Datum pg_ddl_command_out ( PG_FUNCTION_ARGS  )

Definition at line 346 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

347 {
348  ereport(ERROR,
349  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
350  errmsg("cannot output a value of type %s", "pg_ddl_command")));
351 
352  PG_RETURN_VOID();
353 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
Datum pg_ddl_command_recv ( PG_FUNCTION_ARGS  )

Definition at line 359 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

360 {
361  ereport(ERROR,
362  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
363  errmsg("cannot accept a value of type %s", "pg_ddl_command")));
364 
365  PG_RETURN_VOID();
366 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
Datum pg_ddl_command_send ( PG_FUNCTION_ARGS  )

Definition at line 372 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

373 {
374  ereport(ERROR,
375  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
376  errmsg("cannot output a value of type %s", "pg_ddl_command")));
377 
378  PG_RETURN_VOID();
379 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
Datum pg_node_tree_in ( PG_FUNCTION_ARGS  )

Definition at line 274 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

275 {
276  /*
277  * We disallow input of pg_node_tree values because the SQL functions that
278  * operate on the type are not secure against malformed input.
279  */
280  ereport(ERROR,
281  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
282  errmsg("cannot accept a value of type %s", "pg_node_tree")));
283 
284  PG_RETURN_VOID(); /* keep compiler quiet */
285 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
Datum pg_node_tree_out ( PG_FUNCTION_ARGS  )

Definition at line 294 of file pseudotypes.c.

References textout().

295 {
296  return textout(fcinfo);
297 }
Datum textout(PG_FUNCTION_ARGS)
Definition: varlena.c:519
Datum pg_node_tree_recv ( PG_FUNCTION_ARGS  )

Definition at line 303 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

304 {
305  ereport(ERROR,
306  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
307  errmsg("cannot accept a value of type %s", "pg_node_tree")));
308 
309  PG_RETURN_VOID(); /* keep compiler quiet */
310 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
Datum pg_node_tree_send ( PG_FUNCTION_ARGS  )

Definition at line 316 of file pseudotypes.c.

References textsend().

317 {
318  return textsend(fcinfo);
319 }
Datum textsend(PG_FUNCTION_ARGS)
Definition: varlena.c:548
PSEUDOTYPE_DUMMY_IO_FUNCS ( any  )
PSEUDOTYPE_DUMMY_IO_FUNCS ( trigger  )
PSEUDOTYPE_DUMMY_IO_FUNCS ( event_trigger  )
PSEUDOTYPE_DUMMY_IO_FUNCS ( language_handler  )
PSEUDOTYPE_DUMMY_IO_FUNCS ( fdw_handler  )
PSEUDOTYPE_DUMMY_IO_FUNCS ( index_am_handler  )
PSEUDOTYPE_DUMMY_IO_FUNCS ( tsm_handler  )
PSEUDOTYPE_DUMMY_IO_FUNCS ( internal  )
PSEUDOTYPE_DUMMY_IO_FUNCS ( opaque  )
PSEUDOTYPE_DUMMY_IO_FUNCS ( anyelement  )
PSEUDOTYPE_DUMMY_IO_FUNCS ( anynonarray  )
Datum shell_in ( PG_FUNCTION_ARGS  )

Definition at line 243 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

244 {
245  ereport(ERROR,
246  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
247  errmsg("cannot accept a value of a shell type")));
248 
249  PG_RETURN_VOID(); /* keep compiler quiet */
250 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
Datum shell_out ( PG_FUNCTION_ARGS  )

Definition at line 256 of file pseudotypes.c.

References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.

257 {
258  ereport(ERROR,
259  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
260  errmsg("cannot display a value of a shell type")));
261 
262  PG_RETURN_VOID(); /* keep compiler quiet */
263 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define PG_RETURN_VOID()
Definition: fmgr.h:309
int errmsg(const char *fmt,...)
Definition: elog.c:797
Datum void_in ( PG_FUNCTION_ARGS  )

Definition at line 195 of file pseudotypes.c.

References PG_RETURN_VOID.

196 {
197  PG_RETURN_VOID(); /* you were expecting something different? */
198 }
#define PG_RETURN_VOID()
Definition: fmgr.h:309
Datum void_out ( PG_FUNCTION_ARGS  )

Definition at line 206 of file pseudotypes.c.

References PG_RETURN_CSTRING, and pstrdup().

207 {
209 }
char * pstrdup(const char *in)
Definition: mcxt.c:1077
#define PG_RETURN_CSTRING(x)
Definition: fmgr.h:322
Datum void_recv ( PG_FUNCTION_ARGS  )

Definition at line 218 of file pseudotypes.c.

References PG_RETURN_VOID.

219 {
220  PG_RETURN_VOID();
221 }
#define PG_RETURN_VOID()
Definition: fmgr.h:309
Datum void_send ( PG_FUNCTION_ARGS  )

Definition at line 230 of file pseudotypes.c.

References buf, PG_RETURN_BYTEA_P, pq_begintypsend(), and pq_endtypsend().

231 {
233 
234  /* send an empty string */
235  pq_begintypsend(&buf);
237 }
void pq_begintypsend(StringInfo buf)
Definition: pqformat.c:359
#define PG_RETURN_BYTEA_P(x)
Definition: fmgr.h:329
bytea * pq_endtypsend(StringInfo buf)
Definition: pqformat.c:379
static char * buf
Definition: pg_test_fsync.c:65