PostgreSQL Source Code git master
|
#include "postgres.h"
#include <ctype.h>
#include "access/htup_details.h"
#include "catalog/pg_type.h"
#include "common/jsonapi.h"
#include "funcapi.h"
#include "hstore.h"
#include "lib/stringinfo.h"
#include "libpq/pqformat.h"
#include "nodes/miscnodes.h"
#include "parser/scansup.h"
#include "utils/builtins.h"
#include "utils/json.h"
#include "utils/jsonb.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/typcache.h"
Go to the source code of this file.
Data Structures | |
struct | HSParser |
struct | ColumnIOData |
struct | RecordIOData |
Macros | |
#define | RESIZEPRSBUF |
#define | PRSSYNTAXERROR return prssyntaxerror(state) |
#define | PRSEOF return prseof(state) |
#define | GV_WAITVAL 0 |
#define | GV_INVAL 1 |
#define | GV_INESCVAL 2 |
#define | GV_WAITESCIN 3 |
#define | GV_WAITESCESCIN 4 |
#define | WKEY 0 |
#define | WVAL 1 |
#define | WEQ 2 |
#define | WGT 3 |
#define | WDEL 4 |
Typedefs | |
typedef struct ColumnIOData | ColumnIOData |
typedef struct RecordIOData | RecordIOData |
Variables | |
PG_MODULE_MAGIC | |
#define GV_INESCVAL 2 |
Definition at line 88 of file hstore_io.c.
#define GV_INVAL 1 |
Definition at line 87 of file hstore_io.c.
#define GV_WAITESCESCIN 4 |
Definition at line 90 of file hstore_io.c.
#define GV_WAITESCIN 3 |
Definition at line 89 of file hstore_io.c.
#define GV_WAITVAL 0 |
Definition at line 86 of file hstore_io.c.
Definition at line 73 of file hstore_io.c.
#define PRSSYNTAXERROR return prssyntaxerror(state) |
Definition at line 59 of file hstore_io.c.
#define RESIZEPRSBUF |
Definition at line 48 of file hstore_io.c.
#define WDEL 4 |
Definition at line 211 of file hstore_io.c.
#define WEQ 2 |
Definition at line 209 of file hstore_io.c.
#define WGT 3 |
Definition at line 210 of file hstore_io.c.
#define WKEY 0 |
Definition at line 207 of file hstore_io.c.
#define WVAL 1 |
Definition at line 208 of file hstore_io.c.
typedef struct ColumnIOData ColumnIOData |
typedef struct RecordIOData RecordIOData |
|
static |
Definition at line 326 of file hstore_io.c.
References a, b, Pairs::key, Pairs::keylen, Pairs::needfree, and res.
Referenced by hstoreUniquePairs().
|
static |
Definition at line 1207 of file hstore_io.c.
References len.
Referenced by hstore_out().
|
static |
Definition at line 93 of file hstore_io.c.
References elog, ERROR, GV_INESCVAL, GV_INVAL, GV_WAITESCESCIN, GV_WAITESCIN, GV_WAITVAL, palloc(), PRSEOF, PRSSYNTAXERROR, RESIZEPRSBUF, and scanner_isspace().
Referenced by parse_hstore().
Datum hstore_from_array | ( | PG_FUNCTION_ARGS | ) |
Definition at line 715 of file hstore_io.c.
References ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, Assert, deconstruct_array_builtin(), ereport, errcode(), errmsg(), ERROR, hstoreCheckKeyLen(), hstoreCheckValLen(), hstorePairs(), hstoreUniquePairs(), i, Pairs::isnull, Pairs::key, Pairs::keylen, MaxAllocSize, Pairs::needfree, palloc(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_POINTER, Pairs::val, Pairs::vallen, VARDATA, VARHDRSZ, and VARSIZE.
Datum hstore_from_arrays | ( | PG_FUNCTION_ARGS | ) |
Definition at line 599 of file hstore_io.c.
References ARR_DIMS, ARR_ELEMTYPE, ARR_LBOUND, ARR_NDIM, Assert, deconstruct_array_builtin(), ereport, errcode(), errmsg(), ERROR, hstoreCheckKeyLen(), hstoreCheckValLen(), hstorePairs(), hstoreUniquePairs(), i, Pairs::isnull, Pairs::key, Pairs::keylen, MaxAllocSize, Pairs::needfree, palloc(), PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, PG_RETURN_NULL, PG_RETURN_POINTER, Pairs::val, Pairs::vallen, VARDATA, VARHDRSZ, and VARSIZE.
Datum hstore_from_record | ( | PG_FUNCTION_ARGS | ) |
Definition at line 831 of file hstore_io.c.
References Assert, ColumnIOData::column_type, RecordIOData::columns, fmgr_info_cxt(), FmgrInfo::fn_mcxt, get_fn_expr_argtype(), getTypeOutputInfo(), heap_deform_tuple(), HeapTupleHeaderGetDatumLength(), HeapTupleHeaderGetTypeId(), HeapTupleHeaderGetTypMod(), hstoreCheckKeyLen(), hstoreCheckValLen(), hstorePairs(), hstoreUniquePairs(), i, if(), InvalidOid, Pairs::isnull, ItemPointerSetInvalid(), j, Pairs::key, Pairs::keylen, lookup_rowtype_tupdesc_domain(), MaxTupleAttributeNumber, MemoryContextAlloc(), MemSet, NameStr, TupleDescData::natts, RecordIOData::ncolumns, Pairs::needfree, OutputFunctionCall(), palloc(), PG_ARGISNULL, PG_GETARG_HEAPTUPLEHEADER, PG_RETURN_POINTER, ColumnIOData::proc, RecordIOData::record_type, RecordIOData::record_typmod, ReleaseTupleDesc, HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, TupleDescAttr(), ColumnIOData::typiofunc, Pairs::val, Pairs::vallen, value, and values.
Datum hstore_from_text | ( | PG_FUNCTION_ARGS | ) |
Definition at line 563 of file hstore_io.c.
References hstoreCheckKeyLen(), hstoreCheckValLen(), hstorePairs(), Pairs::isnull, Pairs::key, sort-test::key, Pairs::keylen, Pairs::needfree, PG_ARGISNULL, PG_GETARG_TEXT_PP, PG_RETURN_NULL, PG_RETURN_POINTER, Pairs::val, val, Pairs::vallen, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum hstore_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 476 of file hstore_io.c.
References hstorePairs(), hstoreUniquePairs(), parse_hstore(), PG_GETARG_CSTRING, PG_RETURN_NULL, PG_RETURN_POINTER, and str.
Datum hstore_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1222 of file hstore_io.c.
References ARRPTR, cpw(), HS_COUNT, HSTORE_KEY, HSTORE_KEYLEN, HSTORE_VAL, HSTORE_VALISNULL, HSTORE_VALLEN, i, palloc(), PG_GETARG_HSTORE_P, PG_RETURN_CSTRING, pstrdup(), and STRPTR.
HSTORE_POLLUTE | ( | hstore_from_text | , |
tconvert | |||
) |
Datum hstore_populate_record | ( | PG_FUNCTION_ARGS | ) |
Definition at line 990 of file hstore_io.c.
References ARRPTR, ColumnIOData::column_type, RecordIOData::columns, domain_check(), RecordIOData::domain_info, ereport, errcode(), errmsg(), ERROR, fmgr_info_cxt(), FmgrInfo::fn_mcxt, get_fn_expr_argtype(), getTypeInputInfo(), heap_deform_tuple(), heap_form_tuple(), HeapTupleGetDatum(), HeapTupleHeaderGetDatumLength(), HeapTupleHeaderGetTypeId(), HeapTupleHeaderGetTypMod(), HS_COUNT, HSTORE_VAL, HSTORE_VALISNULL, HSTORE_VALLEN, hstoreFindKey(), i, idx(), if(), InputFunctionCall(), InvalidOid, ItemPointerSetInvalid(), lookup_rowtype_tupdesc_domain(), MemoryContextAlloc(), MemSet, NameStr, TupleDescData::natts, RecordIOData::ncolumns, palloc(), PG_ARGISNULL, PG_GETARG_HEAPTUPLEHEADER, PG_GETARG_HSTORE_P, PG_RETURN_DATUM, PG_RETURN_NULL, PG_RETURN_POINTER, ColumnIOData::proc, RecordIOData::record_type, RecordIOData::record_typmod, ReleaseTupleDesc, STRPTR, HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, TupleDescData::tdtypeid, TupleDescAttr(), type_is_rowtype(), ColumnIOData::typiofunc, ColumnIOData::typioparam, value, and values.
Datum hstore_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 500 of file hstore_io.c.
References buf, ereport, errcode(), errmsg(), ERROR, hstoreCheckKeyLen(), hstoreCheckValLen(), hstorePairs(), hstoreUniquePairs(), i, Pairs::isnull, Pairs::key, Pairs::keylen, len, MaxAllocSize, Pairs::needfree, palloc(), PG_GETARG_POINTER, PG_RETURN_POINTER, pq_getmsgint(), pq_getmsgtext(), Pairs::val, and Pairs::vallen.
Datum hstore_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1293 of file hstore_io.c.
References ARRPTR, buf, HS_COUNT, HSTORE_KEY, HSTORE_KEYLEN, HSTORE_VAL, HSTORE_VALISNULL, HSTORE_VALLEN, i, PG_GETARG_HSTORE_P, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendint32(), pq_sendtext(), and STRPTR.
Datum hstore_to_json | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1391 of file hstore_io.c.
References appendStringInfoChar(), appendStringInfoString(), ARRPTR, cstring_to_text_with_len(), StringInfoData::data, escape_json_with_len(), HS_COUNT, HSTORE_KEY, HSTORE_KEYLEN, HSTORE_VAL, HSTORE_VALISNULL, HSTORE_VALLEN, i, initStringInfo(), StringInfoData::len, PG_GETARG_HSTORE_P, PG_RETURN_TEXT_P, and STRPTR.
Datum hstore_to_json_loose | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1339 of file hstore_io.c.
References appendBinaryStringInfo(), appendStringInfoChar(), appendStringInfoString(), ARRPTR, cstring_to_text_with_len(), StringInfoData::data, escape_json_with_len(), HS_COUNT, HSTORE_KEY, HSTORE_KEYLEN, HSTORE_VAL, HSTORE_VALISNULL, HSTORE_VALLEN, i, initStringInfo(), IsValidJsonNumber(), StringInfoData::len, len, PG_GETARG_HSTORE_P, PG_RETURN_TEXT_P, str, and STRPTR.
Datum hstore_to_jsonb | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1432 of file hstore_io.c.
References ARRPTR, HS_COUNT, HSTORE_KEY, HSTORE_KEYLEN, HSTORE_VAL, HSTORE_VALISNULL, HSTORE_VALLEN, i, jbvNull, jbvString, JsonbValueToJsonb(), sort-test::key, PG_GETARG_HSTORE_P, PG_RETURN_POINTER, pushJsonbValue(), res, STRPTR, val, WJB_BEGIN_OBJECT, WJB_END_OBJECT, WJB_KEY, and WJB_VALUE.
Datum hstore_to_jsonb_loose | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1475 of file hstore_io.c.
References appendBinaryStringInfo(), ARRPTR, CStringGetDatum(), StringInfoData::data, DatumGetNumeric(), DirectFunctionCall3, HS_COUNT, HSTORE_KEY, HSTORE_KEYLEN, HSTORE_VAL, HSTORE_VALISNULL, HSTORE_VALLEN, i, initStringInfo(), Int32GetDatum(), InvalidOid, IsValidJsonNumber(), jbvBool, jbvNull, jbvNumeric, jbvString, JsonbValueToJsonb(), sort-test::key, StringInfoData::len, numeric_in(), ObjectIdGetDatum(), PG_GETARG_HSTORE_P, PG_RETURN_POINTER, pushJsonbValue(), res, resetStringInfo(), STRPTR, val, WJB_BEGIN_OBJECT, WJB_END_OBJECT, WJB_KEY, and WJB_VALUE.
size_t hstoreCheckKeyLen | ( | size_t | len | ) |
Definition at line 404 of file hstore_io.c.
References ereport, errcode(), errmsg(), ERROR, HSTORE_MAX_KEY_LEN, and len.
Referenced by hstore_from_array(), hstore_from_arrays(), hstore_from_record(), hstore_from_text(), and hstore_recv().
|
static |
Definition at line 414 of file hstore_io.c.
References ereturn, errcode(), errmsg(), HSTORE_MAX_KEY_LEN, and len.
Referenced by parse_hstore().
size_t hstoreCheckValLen | ( | size_t | len | ) |
Definition at line 424 of file hstore_io.c.
References ereport, errcode(), errmsg(), ERROR, HSTORE_MAX_VALUE_LEN, and len.
Referenced by hstore_from_array(), hstore_from_arrays(), hstore_from_record(), hstore_from_text(), and hstore_recv().
|
static |
Definition at line 434 of file hstore_io.c.
References ereturn, errcode(), errmsg(), HSTORE_MAX_VALUE_LEN, and len.
Referenced by parse_hstore().
Definition at line 445 of file hstore_io.c.
References ARRPTR, buf, CALCDATASIZE, HS_ADDITEM, HS_FINALIZE, HS_SETCOUNT, i, len, palloc(), SET_VARSIZE, and STRPTR.
Referenced by hstore_from_array(), hstore_from_arrays(), hstore_from_record(), hstore_from_text(), hstore_in(), and hstore_recv().
Definition at line 356 of file hstore_io.c.
References a, comparePairs(), Pairs::key, Pairs::keylen, Pairs::needfree, pfree(), qsort, res, and Pairs::val.
Referenced by hstore_from_array(), hstore_from_arrays(), hstore_from_record(), hstore_in(), and hstore_recv().
|
static |
Definition at line 215 of file hstore_io.c.
References elog, ERROR, get_val(), hstoreCheckKeyLength(), hstoreCheckValLength(), palloc(), pg_strcasecmp(), PRSEOF, PRSSYNTAXERROR, repalloc(), scanner_isspace(), SOFT_ERROR_OCCURRED, WDEL, WEQ, WGT, WKEY, and WVAL.
Referenced by hstore_in().
PG_FUNCTION_INFO_V1 | ( | hstore_from_array | ) |
PG_FUNCTION_INFO_V1 | ( | hstore_from_arrays | ) |
PG_FUNCTION_INFO_V1 | ( | hstore_from_record | ) |
PG_FUNCTION_INFO_V1 | ( | hstore_from_text | ) |
PG_FUNCTION_INFO_V1 | ( | hstore_in | ) |
PG_FUNCTION_INFO_V1 | ( | hstore_out | ) |
PG_FUNCTION_INFO_V1 | ( | hstore_populate_record | ) |
PG_FUNCTION_INFO_V1 | ( | hstore_recv | ) |
PG_FUNCTION_INFO_V1 | ( | hstore_send | ) |
PG_FUNCTION_INFO_V1 | ( | hstore_to_json | ) |
PG_FUNCTION_INFO_V1 | ( | hstore_to_json_loose | ) |
PG_FUNCTION_INFO_V1 | ( | hstore_to_jsonb | ) |
PG_FUNCTION_INFO_V1 | ( | hstore_to_jsonb_loose | ) |
|
static |
Definition at line 76 of file hstore_io.c.
|
static |
Definition at line 62 of file hstore_io.c.
References errcode(), errmsg(), errsave, and pg_mblen().
PG_MODULE_MAGIC |
Definition at line 24 of file hstore_io.c.