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 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)
 
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:610
#define PSEUDOTYPE_DUMMY_RECEIVE_FUNC(typname)
Definition: pseudotypes.c:70
#define ERROR
Definition: elog.h:43
NameData typname
Definition: pg_type.h:41
#define PG_RETURN_VOID()
Definition: fmgr.h:348
int errmsg(const char *fmt,...)
Definition: elog.c:824
#define PG_FUNCTION_ARGS
Definition: fmgr.h:193

Definition at line 83 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:610
#define ERROR
Definition: elog.h:43
NameData typname
Definition: pg_type.h:41
#define PG_RETURN_VOID()
Definition: fmgr.h:348
int errmsg(const char *fmt,...)
Definition: elog.c:824
#define PG_FUNCTION_ARGS
Definition: fmgr.h:193

Definition at line 36 of file pseudotypes.c.

Referenced by anyarray_send(), anycompatiblearray_send(), 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:610
#define ERROR
Definition: elog.h:43
#define PSEUDOTYPE_DUMMY_INPUT_FUNC(typname)
Definition: pseudotypes.c:36
NameData typname
Definition: pg_type.h:41
#define PG_RETURN_VOID()
Definition: fmgr.h:348
int errmsg(const char *fmt,...)
Definition: elog.c:824
#define PG_FUNCTION_ARGS
Definition: fmgr.h:193

Definition at line 49 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:610
#define ERROR
Definition: elog.h:43
NameData typname
Definition: pg_type.h:41
#define PG_RETURN_VOID()
Definition: fmgr.h:348
int errmsg(const char *fmt,...)
Definition: elog.c:824
#define PG_FUNCTION_ARGS
Definition: fmgr.h:193

Definition at line 70 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 160 of file pseudotypes.c.

References array_out().

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

◆ anyarray_send()

Datum anyarray_send ( PG_FUNCTION_ARGS  )

Definition at line 166 of file pseudotypes.c.

References array_send(), PSEUDOTYPE_DUMMY_INPUT_FUNC, and PSEUDOTYPE_DUMMY_RECEIVE_FUNC.

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

◆ anycompatiblearray_out()

Datum anycompatiblearray_out ( PG_FUNCTION_ARGS  )

Definition at line 180 of file pseudotypes.c.

References array_out().

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

◆ anycompatiblearray_send()

Datum anycompatiblearray_send ( PG_FUNCTION_ARGS  )

Definition at line 186 of file pseudotypes.c.

References array_send(), and PSEUDOTYPE_DUMMY_INPUT_FUNC.

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

◆ anycompatiblerange_out()

Datum anycompatiblerange_out ( PG_FUNCTION_ARGS  )

Definition at line 225 of file pseudotypes.c.

References range_out().

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

◆ anyenum_out()

Datum anyenum_out ( PG_FUNCTION_ARGS  )

Definition at line 199 of file pseudotypes.c.

References enum_out(), and PSEUDOTYPE_DUMMY_INPUT_FUNC.

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

◆ anyrange_out()

Datum anyrange_out ( PG_FUNCTION_ARGS  )

Definition at line 212 of file pseudotypes.c.

References PSEUDOTYPE_DUMMY_INPUT_FUNC, and range_out().

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

◆ cstring_in()

Datum cstring_in ( PG_FUNCTION_ARGS  )

Definition at line 109 of file pseudotypes.c.

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

110 {
111  char *str = PG_GETARG_CSTRING(0);
112 
114 }
char * pstrdup(const char *in)
Definition: mcxt.c:1186
#define PG_RETURN_CSTRING(x)
Definition: fmgr.h:361
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:277

◆ cstring_out()

Datum cstring_out ( PG_FUNCTION_ARGS  )

Definition at line 117 of file pseudotypes.c.

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

118 {
119  char *str = PG_GETARG_CSTRING(0);
120 
122 }
char * pstrdup(const char *in)
Definition: mcxt.c:1186
#define PG_RETURN_CSTRING(x)
Definition: fmgr.h:361
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:277

◆ cstring_recv()

Datum cstring_recv ( PG_FUNCTION_ARGS  )

Definition at line 125 of file pseudotypes.c.

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

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

◆ cstring_send()

Datum cstring_send ( PG_FUNCTION_ARGS  )

Definition at line 136 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.

137 {
138  char *str = PG_GETARG_CSTRING(0);
140 
141  pq_begintypsend(&buf);
142  pq_sendtext(&buf, str, strlen(str));
144 }
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:369
bytea * pq_endtypsend(StringInfo buf)
Definition: pqformat.c:348
static char * buf
Definition: pg_test_fsync.c:67
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:277

◆ pg_node_tree_out()

Datum pg_node_tree_out ( PG_FUNCTION_ARGS  )

Definition at line 314 of file pseudotypes.c.

References textout().

315 {
316  return textout(fcinfo);
317 }
Datum textout(PG_FUNCTION_ARGS)
Definition: varlena.c:553

◆ pg_node_tree_send()

Datum pg_node_tree_send ( PG_FUNCTION_ARGS  )

Definition at line 320 of file pseudotypes.c.

References PSEUDOTYPE_DUMMY_BINARY_IO_FUNCS, PSEUDOTYPE_DUMMY_IO_FUNCS, and textsend().

321 {
322  return textsend(fcinfo);
323 }
Datum textsend(PG_FUNCTION_ARGS)
Definition: varlena.c:582

◆ PSEUDOTYPE_DUMMY_BINARY_IO_FUNCS()

PSEUDOTYPE_DUMMY_BINARY_IO_FUNCS ( pg_ddl_command  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [1/6]

PSEUDOTYPE_DUMMY_INPUT_FUNC ( anyarray  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [2/6]

PSEUDOTYPE_DUMMY_INPUT_FUNC ( anycompatiblearray  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [3/6]

PSEUDOTYPE_DUMMY_INPUT_FUNC ( anyenum  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [4/6]

PSEUDOTYPE_DUMMY_INPUT_FUNC ( anyrange  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [5/6]

PSEUDOTYPE_DUMMY_INPUT_FUNC ( anycompatiblerange  )

◆ PSEUDOTYPE_DUMMY_INPUT_FUNC() [6/6]

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 279 of file pseudotypes.c.

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

280 {
281  ereport(ERROR,
282  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
283  errmsg("cannot accept a value of a shell type")));
284 
285  PG_RETURN_VOID(); /* keep compiler quiet */
286 }
int errcode(int sqlerrcode)
Definition: elog.c:610
#define ERROR
Definition: elog.h:43
#define ereport(elevel,...)
Definition: elog.h:144
#define PG_RETURN_VOID()
Definition: fmgr.h:348
int errmsg(const char *fmt,...)
Definition: elog.c:824

◆ shell_out()

Datum shell_out ( PG_FUNCTION_ARGS  )

Definition at line 289 of file pseudotypes.c.

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

290 {
291  ereport(ERROR,
292  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
293  errmsg("cannot display a value of a shell type")));
294 
295  PG_RETURN_VOID(); /* keep compiler quiet */
296 }
int errcode(int sqlerrcode)
Definition: elog.c:610
#define ERROR
Definition: elog.h:43
#define ereport(elevel,...)
Definition: elog.h:144
#define PG_RETURN_VOID()
Definition: fmgr.h:348
int errmsg(const char *fmt,...)
Definition: elog.c:824

◆ void_in()

Datum void_in ( PG_FUNCTION_ARGS  )

Definition at line 239 of file pseudotypes.c.

References PG_RETURN_VOID.

240 {
241  PG_RETURN_VOID(); /* you were expecting something different? */
242 }
#define PG_RETURN_VOID()
Definition: fmgr.h:348

◆ void_out()

Datum void_out ( PG_FUNCTION_ARGS  )

Definition at line 245 of file pseudotypes.c.

References PG_RETURN_CSTRING, and pstrdup().

246 {
248 }
char * pstrdup(const char *in)
Definition: mcxt.c:1186
#define PG_RETURN_CSTRING(x)
Definition: fmgr.h:361

◆ void_recv()

Datum void_recv ( PG_FUNCTION_ARGS  )

Definition at line 251 of file pseudotypes.c.

References PG_RETURN_VOID.

252 {
253  /*
254  * Note that since we consume no bytes, an attempt to send anything but an
255  * empty string will result in an "invalid message format" error.
256  */
257  PG_RETURN_VOID();
258 }
#define PG_RETURN_VOID()
Definition: fmgr.h:348

◆ void_send()

Datum void_send ( PG_FUNCTION_ARGS  )

Definition at line 261 of file pseudotypes.c.

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

262 {
264 
265  /* send an empty string */
266  pq_begintypsend(&buf);
268 }
void pq_begintypsend(StringInfo buf)
Definition: pqformat.c:328
#define PG_RETURN_BYTEA_P(x)
Definition: fmgr.h:369
bytea * pq_endtypsend(StringInfo buf)
Definition: pqformat.c:348
static char * buf
Definition: pg_test_fsync.c:67