PostgreSQL Source Code  git master
pseudotypes.c File Reference
#include "postgres.h"
#include "libpq/pqformat.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/rangetypes.h"
#include "utils/multirangetypes.h"
Include dependency graph for pseudotypes.c:

Go to the source code of this file.

Macros

#define PSEUDOTYPE_DUMMY_INPUT_FUNC(typname)
 
#define PSEUDOTYPE_DUMMY_IO_FUNCS(typname)
 
#define PSEUDOTYPE_DUMMY_RECEIVE_FUNC(typname)
 
#define PSEUDOTYPE_DUMMY_BINARY_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)
 
 PSEUDOTYPE_DUMMY_INPUT_FUNC (anyarray)
 
 PSEUDOTYPE_DUMMY_RECEIVE_FUNC (anyarray)
 
Datum anyarray_out (PG_FUNCTION_ARGS)
 
Datum anyarray_send (PG_FUNCTION_ARGS)
 
 PSEUDOTYPE_DUMMY_INPUT_FUNC (anycompatiblearray)
 
 PSEUDOTYPE_DUMMY_RECEIVE_FUNC (anycompatiblearray)
 
Datum anycompatiblearray_out (PG_FUNCTION_ARGS)
 
Datum anycompatiblearray_send (PG_FUNCTION_ARGS)
 
 PSEUDOTYPE_DUMMY_INPUT_FUNC (anyenum)
 
Datum anyenum_out (PG_FUNCTION_ARGS)
 
 PSEUDOTYPE_DUMMY_INPUT_FUNC (anyrange)
 
Datum anyrange_out (PG_FUNCTION_ARGS)
 
 PSEUDOTYPE_DUMMY_INPUT_FUNC (anycompatiblerange)
 
Datum anycompatiblerange_out (PG_FUNCTION_ARGS)
 
 PSEUDOTYPE_DUMMY_INPUT_FUNC (anycompatiblemultirange)
 
Datum anycompatiblemultirange_out (PG_FUNCTION_ARGS)
 
Datum anymultirange_in (PG_FUNCTION_ARGS)
 
Datum anymultirange_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)
 
 PSEUDOTYPE_DUMMY_INPUT_FUNC (pg_node_tree)
 
 PSEUDOTYPE_DUMMY_RECEIVE_FUNC (pg_node_tree)
 
Datum pg_node_tree_out (PG_FUNCTION_ARGS)
 
Datum pg_node_tree_send (PG_FUNCTION_ARGS)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (pg_ddl_command)
 
 PSEUDOTYPE_DUMMY_BINARY_IO_FUNCS (pg_ddl_command)
 
 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 (table_am_handler)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (index_am_handler)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (tsm_handler)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (internal)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (anyelement)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (anynonarray)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (anycompatible)
 
 PSEUDOTYPE_DUMMY_IO_FUNCS (anycompatiblenonarray)
 

Macro Definition Documentation

◆ PSEUDOTYPE_DUMMY_BINARY_IO_FUNCS

#define PSEUDOTYPE_DUMMY_BINARY_IO_FUNCS (   typname)
Value:
\
Datum \
typname##_send(PG_FUNCTION_ARGS) \
{ \
ereport(ERROR, \
(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:704
#define PSEUDOTYPE_DUMMY_RECEIVE_FUNC(typname)
Definition: pseudotypes.c:71
#define ERROR
Definition: elog.h:45
NameData typname
Definition: pg_type.h:41
#define PG_RETURN_VOID()
Definition: fmgr.h:349
int errmsg(const char *fmt,...)
Definition: elog.c:915
#define PG_FUNCTION_ARGS
Definition: fmgr.h:193

Definition at line 84 of file pseudotypes.c.

Referenced by pg_node_tree_send().

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC

#define PSEUDOTYPE_DUMMY_INPUT_FUNC (   typname)
Value:
Datum \
typname##_in(PG_FUNCTION_ARGS) \
{ \
ereport(ERROR, \
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), \
errmsg("cannot accept a value of type %s", #typname))); \
PG_RETURN_VOID(); /* keep compiler quiet */ \
} \
\
extern int no_such_variable
int errcode(int sqlerrcode)
Definition: elog.c:704
#define ERROR
Definition: elog.h:45
NameData typname
Definition: pg_type.h:41
#define PG_RETURN_VOID()
Definition: fmgr.h:349
int errmsg(const char *fmt,...)
Definition: elog.c:915
#define PG_FUNCTION_ARGS
Definition: fmgr.h:193

Definition at line 37 of file pseudotypes.c.

Referenced by anyarray_send(), anycompatiblearray_send(), anycompatiblerange_out(), anyenum_out(), anyrange_out(), cstring_send(), and shell_out().

◆ PSEUDOTYPE_DUMMY_IO_FUNCS

#define PSEUDOTYPE_DUMMY_IO_FUNCS (   typname)
Value:
\
Datum \
typname##_out(PG_FUNCTION_ARGS) \
{ \
ereport(ERROR, \
(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:704
#define ERROR
Definition: elog.h:45
#define PSEUDOTYPE_DUMMY_INPUT_FUNC(typname)
Definition: pseudotypes.c:37
NameData typname
Definition: pg_type.h:41
#define PG_RETURN_VOID()
Definition: fmgr.h:349
int errmsg(const char *fmt,...)
Definition: elog.c:915
#define PG_FUNCTION_ARGS
Definition: fmgr.h:193

Definition at line 50 of file pseudotypes.c.

Referenced by pg_node_tree_send().

◆ PSEUDOTYPE_DUMMY_RECEIVE_FUNC

#define PSEUDOTYPE_DUMMY_RECEIVE_FUNC (   typname)
Value:
Datum \
typname##_recv(PG_FUNCTION_ARGS) \
{ \
ereport(ERROR, \
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), \
errmsg("cannot accept a value of type %s", #typname))); \
PG_RETURN_VOID(); /* keep compiler quiet */ \
} \
\
extern int no_such_variable
int errcode(int sqlerrcode)
Definition: elog.c:704
#define ERROR
Definition: elog.h:45
NameData typname
Definition: pg_type.h:41
#define PG_RETURN_VOID()
Definition: fmgr.h:349
int errmsg(const char *fmt,...)
Definition: elog.c:915
#define PG_FUNCTION_ARGS
Definition: fmgr.h:193

Definition at line 71 of file pseudotypes.c.

Referenced by anyarray_send(), cstring_send(), and shell_out().

Function Documentation

◆ anyarray_out()

Datum anyarray_out ( PG_FUNCTION_ARGS  )

Definition at line 161 of file pseudotypes.c.

References array_out().

162 {
163  return array_out(fcinfo);
164 }
Datum array_out(PG_FUNCTION_ARGS)
Definition: arrayfuncs.c:1013

◆ anyarray_send()

Datum anyarray_send ( PG_FUNCTION_ARGS  )

Definition at line 167 of file pseudotypes.c.

References array_send(), PSEUDOTYPE_DUMMY_INPUT_FUNC, and PSEUDOTYPE_DUMMY_RECEIVE_FUNC.

168 {
169  return array_send(fcinfo);
170 }
Datum array_send(PG_FUNCTION_ARGS)
Definition: arrayfuncs.c:1569

◆ anycompatiblearray_out()

Datum anycompatiblearray_out ( PG_FUNCTION_ARGS  )

Definition at line 181 of file pseudotypes.c.

References array_out().

182 {
183  return array_out(fcinfo);
184 }
Datum array_out(PG_FUNCTION_ARGS)
Definition: arrayfuncs.c:1013

◆ anycompatiblearray_send()

Datum anycompatiblearray_send ( PG_FUNCTION_ARGS  )

Definition at line 187 of file pseudotypes.c.

References array_send(), and PSEUDOTYPE_DUMMY_INPUT_FUNC.

188 {
189  return array_send(fcinfo);
190 }
Datum array_send(PG_FUNCTION_ARGS)
Definition: arrayfuncs.c:1569

◆ anycompatiblemultirange_out()

Datum anycompatiblemultirange_out ( PG_FUNCTION_ARGS  )

Definition at line 239 of file pseudotypes.c.

References multirange_out().

240 {
241  return multirange_out(fcinfo);
242 }
Datum multirange_out(PG_FUNCTION_ARGS)

◆ anycompatiblerange_out()

Datum anycompatiblerange_out ( PG_FUNCTION_ARGS  )

Definition at line 226 of file pseudotypes.c.

References PSEUDOTYPE_DUMMY_INPUT_FUNC, and range_out().

227 {
228  return range_out(fcinfo);
229 }
Datum range_out(PG_FUNCTION_ARGS)
Definition: rangetypes.c:120

◆ anyenum_out()

Datum anyenum_out ( PG_FUNCTION_ARGS  )

Definition at line 200 of file pseudotypes.c.

References enum_out(), and PSEUDOTYPE_DUMMY_INPUT_FUNC.

201 {
202  return enum_out(fcinfo);
203 }
Datum enum_out(PG_FUNCTION_ARGS)
Definition: enum.c:149

◆ anymultirange_in()

Datum anymultirange_in ( PG_FUNCTION_ARGS  )

Definition at line 248 of file pseudotypes.c.

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

249 {
250  ereport(ERROR,
251  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
252  errmsg("cannot accept a value of type %s", "anymultirange")));
253 
254  PG_RETURN_VOID(); /* keep compiler quiet */
255 }
int errcode(int sqlerrcode)
Definition: elog.c:704
#define ERROR
Definition: elog.h:45
#define ereport(elevel,...)
Definition: elog.h:155
#define PG_RETURN_VOID()
Definition: fmgr.h:349
int errmsg(const char *fmt,...)
Definition: elog.c:915

◆ anymultirange_out()

Datum anymultirange_out ( PG_FUNCTION_ARGS  )

Definition at line 263 of file pseudotypes.c.

References multirange_out().

264 {
265  return multirange_out(fcinfo);
266 }
Datum multirange_out(PG_FUNCTION_ARGS)

◆ anyrange_out()

Datum anyrange_out ( PG_FUNCTION_ARGS  )

Definition at line 213 of file pseudotypes.c.

References PSEUDOTYPE_DUMMY_INPUT_FUNC, and range_out().

214 {
215  return range_out(fcinfo);
216 }
Datum range_out(PG_FUNCTION_ARGS)
Definition: rangetypes.c:120

◆ cstring_in()

Datum cstring_in ( PG_FUNCTION_ARGS  )

Definition at line 110 of file pseudotypes.c.

References PG_GETARG_CSTRING, PG_RETURN_CSTRING, pstrdup(), and generate_unaccent_rules::str.

111 {
112  char *str = PG_GETARG_CSTRING(0);
113 
115 }
char * pstrdup(const char *in)
Definition: mcxt.c:1187
#define PG_RETURN_CSTRING(x)
Definition: fmgr.h:362
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:277

◆ cstring_out()

Datum cstring_out ( PG_FUNCTION_ARGS  )

Definition at line 118 of file pseudotypes.c.

References PG_GETARG_CSTRING, PG_RETURN_CSTRING, pstrdup(), and generate_unaccent_rules::str.

119 {
120  char *str = PG_GETARG_CSTRING(0);
121 
123 }
char * pstrdup(const char *in)
Definition: mcxt.c:1187
#define PG_RETURN_CSTRING(x)
Definition: fmgr.h:362
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:277

◆ cstring_recv()

Datum cstring_recv ( PG_FUNCTION_ARGS  )

Definition at line 126 of file pseudotypes.c.

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

127 {
129  char *str;
130  int nbytes;
131 
132  str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes);
133  PG_RETURN_CSTRING(str);
134 }
StringInfoData * StringInfo
Definition: stringinfo.h:44
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:276
static char * buf
Definition: pg_test_fsync.c:68
char * pq_getmsgtext(StringInfo msg, int rawbytes, int *nbytes)
Definition: pqformat.c:548
#define PG_RETURN_CSTRING(x)
Definition: fmgr.h:362

◆ cstring_send()

Datum cstring_send ( PG_FUNCTION_ARGS  )

Definition at line 137 of file pseudotypes.c.

References buf, PG_GETARG_CSTRING, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendtext(), PSEUDOTYPE_DUMMY_INPUT_FUNC, PSEUDOTYPE_DUMMY_RECEIVE_FUNC, and generate_unaccent_rules::str.

138 {
139  char *str = PG_GETARG_CSTRING(0);
141 
142  pq_begintypsend(&buf);
143  pq_sendtext(&buf, str, strlen(str));
145 }
void pq_begintypsend(StringInfo buf)
Definition: pqformat.c:328
void pq_sendtext(StringInfo buf, const char *str, int slen)
Definition: pqformat.c:174
#define PG_RETURN_BYTEA_P(x)
Definition: fmgr.h:371
bytea * pq_endtypsend(StringInfo buf)
Definition: pqformat.c:348
static char * buf
Definition: pg_test_fsync.c:68
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:277

◆ pg_node_tree_out()

Datum pg_node_tree_out ( PG_FUNCTION_ARGS  )

Definition at line 352 of file pseudotypes.c.

References textout().

353 {
354  return textout(fcinfo);
355 }
Datum textout(PG_FUNCTION_ARGS)
Definition: varlena.c:576

◆ pg_node_tree_send()

Datum pg_node_tree_send ( PG_FUNCTION_ARGS  )

Definition at line 358 of file pseudotypes.c.

References PSEUDOTYPE_DUMMY_BINARY_IO_FUNCS, PSEUDOTYPE_DUMMY_IO_FUNCS, and textsend().

359 {
360  return textsend(fcinfo);
361 }
Datum textsend(PG_FUNCTION_ARGS)
Definition: varlena.c:605

◆ PSEUDOTYPE_DUMMY_BINARY_IO_FUNCS()

PSEUDOTYPE_DUMMY_BINARY_IO_FUNCS ( pg_ddl_command  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [1/7]

PSEUDOTYPE_DUMMY_INPUT_FUNC ( anyarray  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [2/7]

PSEUDOTYPE_DUMMY_INPUT_FUNC ( anycompatiblearray  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [3/7]

PSEUDOTYPE_DUMMY_INPUT_FUNC ( anyenum  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [4/7]

PSEUDOTYPE_DUMMY_INPUT_FUNC ( anyrange  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [5/7]

PSEUDOTYPE_DUMMY_INPUT_FUNC ( anycompatiblerange  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [6/7]

PSEUDOTYPE_DUMMY_INPUT_FUNC ( anycompatiblemultirange  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [7/7]

PSEUDOTYPE_DUMMY_INPUT_FUNC ( pg_node_tree  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [1/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( pg_ddl_command  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [2/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( any  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [3/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( trigger  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [4/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( event_trigger  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [5/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( language_handler  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [6/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( fdw_handler  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [7/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( table_am_handler  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [8/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( index_am_handler  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [9/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( tsm_handler  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [10/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( internal  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [11/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( anyelement  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [12/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( anynonarray  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [13/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( anycompatible  )

◆ PSEUDOTYPE_DUMMY_IO_FUNCS() [14/14]

PSEUDOTYPE_DUMMY_IO_FUNCS ( anycompatiblenonarray  )

◆ PSEUDOTYPE_DUMMY_RECEIVE_FUNC() [1/3]

PSEUDOTYPE_DUMMY_RECEIVE_FUNC ( anyarray  )

◆ PSEUDOTYPE_DUMMY_RECEIVE_FUNC() [2/3]

PSEUDOTYPE_DUMMY_RECEIVE_FUNC ( anycompatiblearray  )

◆ PSEUDOTYPE_DUMMY_RECEIVE_FUNC() [3/3]

PSEUDOTYPE_DUMMY_RECEIVE_FUNC ( pg_node_tree  )

◆ shell_in()

Datum shell_in ( PG_FUNCTION_ARGS  )

Definition at line 317 of file pseudotypes.c.

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

318 {
319  ereport(ERROR,
320  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
321  errmsg("cannot accept a value of a shell type")));
322 
323  PG_RETURN_VOID(); /* keep compiler quiet */
324 }
int errcode(int sqlerrcode)
Definition: elog.c:704
#define ERROR
Definition: elog.h:45
#define ereport(elevel,...)
Definition: elog.h:155
#define PG_RETURN_VOID()
Definition: fmgr.h:349
int errmsg(const char *fmt,...)
Definition: elog.c:915

◆ shell_out()

Datum shell_out ( PG_FUNCTION_ARGS  )

Definition at line 327 of file pseudotypes.c.

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

328 {
329  ereport(ERROR,
330  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
331  errmsg("cannot display a value of a shell type")));
332 
333  PG_RETURN_VOID(); /* keep compiler quiet */
334 }
int errcode(int sqlerrcode)
Definition: elog.c:704
#define ERROR
Definition: elog.h:45
#define ereport(elevel,...)
Definition: elog.h:155
#define PG_RETURN_VOID()
Definition: fmgr.h:349
int errmsg(const char *fmt,...)
Definition: elog.c:915

◆ void_in()

Datum void_in ( PG_FUNCTION_ARGS  )

Definition at line 277 of file pseudotypes.c.

References PG_RETURN_VOID.

278 {
279  PG_RETURN_VOID(); /* you were expecting something different? */
280 }
#define PG_RETURN_VOID()
Definition: fmgr.h:349

◆ void_out()

Datum void_out ( PG_FUNCTION_ARGS  )

Definition at line 283 of file pseudotypes.c.

References PG_RETURN_CSTRING, and pstrdup().

284 {
286 }
char * pstrdup(const char *in)
Definition: mcxt.c:1187
#define PG_RETURN_CSTRING(x)
Definition: fmgr.h:362

◆ void_recv()

Datum void_recv ( PG_FUNCTION_ARGS  )

Definition at line 289 of file pseudotypes.c.

References PG_RETURN_VOID.

290 {
291  /*
292  * Note that since we consume no bytes, an attempt to send anything but an
293  * empty string will result in an "invalid message format" error.
294  */
295  PG_RETURN_VOID();
296 }
#define PG_RETURN_VOID()
Definition: fmgr.h:349

◆ void_send()

Datum void_send ( PG_FUNCTION_ARGS  )

Definition at line 299 of file pseudotypes.c.

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

300 {
302 
303  /* send an empty string */
304  pq_begintypsend(&buf);
306 }
void pq_begintypsend(StringInfo buf)
Definition: pqformat.c:328
#define PG_RETURN_BYTEA_P(x)
Definition: fmgr.h:371
bytea * pq_endtypsend(StringInfo buf)
Definition: pqformat.c:348
static char * buf
Definition: pg_test_fsync.c:68