PostgreSQL Source Code
git master
|
#include "access/xlogreader.h"
#include "catalog/objectaddress.h"
#include "fmgr.h"
#include "lib/stringinfo.h"
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
#include "storage/relfilenode.h"
Go to the source code of this file.
Data Structures | |
struct | FormData_pg_sequence_data |
struct | xl_seq_rec |
Macros | |
#define | SEQ_COL_LASTVAL 1 |
#define | SEQ_COL_LOG 2 |
#define | SEQ_COL_CALLED 3 |
#define | SEQ_COL_FIRSTCOL SEQ_COL_LASTVAL |
#define | SEQ_COL_LASTCOL SEQ_COL_CALLED |
#define | XLOG_SEQ_LOG 0x00 |
Typedefs | |
typedef struct FormData_pg_sequence_data | FormData_pg_sequence_data |
typedef FormData_pg_sequence_data * | Form_pg_sequence_data |
typedef struct xl_seq_rec | xl_seq_rec |
Functions | |
int64 | nextval_internal (Oid relid, bool check_permissions) |
Datum | nextval (PG_FUNCTION_ARGS) |
List * | sequence_options (Oid relid) |
ObjectAddress | DefineSequence (ParseState *pstate, CreateSeqStmt *stmt) |
ObjectAddress | AlterSequence (ParseState *pstate, AlterSeqStmt *stmt) |
void | DeleteSequenceTuple (Oid relid) |
void | ResetSequence (Oid seq_relid) |
void | ResetSequenceCaches (void) |
void | seq_redo (XLogReaderState *rptr) |
void | seq_desc (StringInfo buf, XLogReaderState *rptr) |
const char * | seq_identify (uint8 info) |
void | seq_mask (char *pagedata, BlockNumber blkno) |
#define SEQ_COL_CALLED 3 |
Definition at line 40 of file sequence.h.
Referenced by DefineSequence().
#define SEQ_COL_FIRSTCOL SEQ_COL_LASTVAL |
Definition at line 42 of file sequence.h.
Referenced by DefineSequence().
#define SEQ_COL_LASTCOL SEQ_COL_CALLED |
Definition at line 43 of file sequence.h.
Referenced by DefineSequence().
#define SEQ_COL_LASTVAL 1 |
Definition at line 38 of file sequence.h.
Referenced by DefineSequence().
#define SEQ_COL_LOG 2 |
Definition at line 39 of file sequence.h.
Referenced by DefineSequence().
#define XLOG_SEQ_LOG 0x00 |
Definition at line 46 of file sequence.h.
Referenced by do_setval(), fill_seq_with_data(), nextval_internal(), seq_desc(), seq_identify(), and seq_redo().
Definition at line 32 of file sequence.h.
typedef struct FormData_pg_sequence_data FormData_pg_sequence_data |
typedef struct xl_seq_rec xl_seq_rec |
ObjectAddress AlterSequence | ( | ParseState * | pstate, |
AlterSeqStmt * | stmt | ||
) |
Definition at line 422 of file sequence.c.
References Assert, buf, SeqTableData::cached, CatalogTupleUpdate(), elog, ereport, errmsg(), ERROR, fill_seq_with_data(), AlterSeqStmt::for_identity, GETSTRUCT, GetTopTransactionId(), heap_copytuple(), HeapTupleIsValid, init_params(), init_sequence(), InvalidMultiXactId, InvalidObjectAddress, InvalidOid, InvalidTransactionId, InvokeObjectPostAlterHook, SeqTableData::last, AlterSeqStmt::missing_ok, NoLock, NOTICE, ObjectAddressSet, ObjectIdGetDatum, AlterSeqStmt::options, process_owned_by(), RangeVarCallbackOwnsRelation(), RangeVarGetRelidExtended(), RelationData::rd_rel, read_seq_tuple(), relation_close(), RelationNeedsWAL, RelationSetNewRelfilenode(), RangeVar::relname, RowExclusiveLock, RVR_MISSING_OK, SearchSysCacheCopy1, SEQRELID, AlterSeqStmt::sequence, ShareRowExclusiveLock, HeapTupleData::t_self, table_close(), table_open(), and UnlockReleaseBuffer().
Referenced by ProcessUtilitySlow().
ObjectAddress DefineSequence | ( | ParseState * | pstate, |
CreateSeqStmt * | stmt | ||
) |
Definition at line 118 of file sequence.c.
References AccessExclusiveLock, Assert, BoolGetDatum, CatalogTupleInsert(), ColumnDef::collClause, ColumnDef::collOid, ColumnDef::colname, ColumnDef::constraints, CreateStmt::constraints, ColumnDef::cooked_default, DefineRelation(), ereport, errcode(), errmsg(), ERROR, fill_seq_with_data(), CreateSeqStmt::for_identity, FormData_pg_sequence, heap_form_tuple(), heap_freetuple(), i, CreateStmt::if_not_exists, CreateSeqStmt::if_not_exists, ColumnDef::inhcount, CreateStmt::inhRelations, init_params(), Int64GetDatum(), Int64GetDatumFast, InvalidObjectAddress, InvalidOid, ColumnDef::is_from_type, ColumnDef::is_local, ColumnDef::is_not_null, lappend(), FormData_pg_sequence_data::last_value, ColumnDef::location, makeNode, makeTypeNameFromOid(), NIL, NoLock, NOTICE, ObjectAddress::objectId, ObjectIdGetDatum, OidIsValid, CreateStmt::oncommit, ONCOMMIT_NOOP, CreateStmt::options, CreateSeqStmt::options, CreateSeqStmt::ownerId, process_owned_by(), RangeVarGetAndCheckCreationNamespace(), ColumnDef::raw_default, CreateStmt::relation, RelationGetDescr, RangeVar::relname, RangeVar::relpersistence, RowExclusiveLock, SEQ_COL_CALLED, SEQ_COL_FIRSTCOL, SEQ_COL_LASTCOL, SEQ_COL_LASTVAL, SEQ_COL_LOG, CreateSeqStmt::sequence, ColumnDef::storage, table_close(), table_open(), CreateStmt::tableElts, CreateStmt::tablespacename, ColumnDef::typeName, and value.
Referenced by ProcessUtilitySlow().
void DeleteSequenceTuple | ( | Oid | relid | ) |
Definition at line 526 of file sequence.c.
References CatalogTupleDelete(), elog, ERROR, HeapTupleIsValid, ObjectIdGetDatum, ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), SEQRELID, HeapTupleData::t_self, table_close(), and table_open().
Referenced by doDeletion().
Datum nextval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 549 of file sequence.c.
References makeRangeVarFromNameList(), nextval_internal(), NoLock, PG_GETARG_TEXT_PP, PG_RETURN_INT64, RangeVarGetRelid, and textToQualifiedNameList().
Referenced by autoinc(), and ttdummy().
Definition at line 579 of file sequence.c.
References ACL_UPDATE, ACL_USAGE, ACLCHECK_OK, Assert, buf, BufferGetPage, SeqTableData::cached, elog, END_CRIT_SECTION, ereport, errcode(), errmsg(), ERROR, GetRedoRecPtr(), GETSTRUCT, GetTopTransactionId(), GetUserId(), HeapTupleIsValid, SeqTableData::increment, init_sequence(), INT64_FORMAT, FormData_pg_sequence_data::is_called, SeqTableData::last, SeqTableData::last_valid, FormData_pg_sequence_data::last_value, FormData_pg_sequence_data::log_cnt, MarkBufferDirty(), next, xl_seq_rec::node, NoLock, ObjectIdGetDatum, PageGetLSN, PageSetLSN, pg_class_aclcheck(), PreventCommandIfParallelMode(), PreventCommandIfReadOnly(), RelationData::rd_islocaltemp, RelationData::rd_node, read_seq_tuple(), REGBUF_WILL_INIT, relation_close(), RelationGetRelationName, RelationNeedsWAL, ReleaseSysCache(), SeqTableData::relid, SearchSysCache1(), SEQ_LOG_VALS, SEQRELID, snprintf, START_CRIT_SECTION, HeapTupleData::t_data, HeapTupleData::t_len, UnlockReleaseBuffer(), XLOG_SEQ_LOG, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by ExecEvalNextValueExpr(), nextval(), and nextval_oid().
void ResetSequence | ( | Oid | seq_relid | ) |
Definition at line 270 of file sequence.c.
References Assert, buf, SeqTableData::cached, elog, ERROR, fill_seq_with_data(), GETSTRUCT, heap_copytuple(), HeapTupleIsValid, init_sequence(), InvalidMultiXactId, InvalidTransactionId, FormData_pg_sequence_data::is_called, SeqTableData::last, FormData_pg_sequence_data::last_value, FormData_pg_sequence_data::log_cnt, NoLock, ObjectIdGetDatum, RelationData::rd_rel, read_seq_tuple(), relation_close(), RelationSetNewRelfilenode(), ReleaseSysCache(), SearchSysCache1(), SEQRELID, and UnlockReleaseBuffer().
Referenced by ExecuteTruncateGuts().
void ResetSequenceCaches | ( | void | ) |
Definition at line 1935 of file sequence.c.
References hash_destroy().
Referenced by DiscardAll(), and DiscardCommand().
void seq_desc | ( | StringInfo | buf, |
XLogReaderState * | rptr | ||
) |
Definition at line 21 of file seqdesc.c.
References appendStringInfo(), RelFileNode::dbNode, xl_seq_rec::node, RelFileNode::relNode, RelFileNode::spcNode, XLOG_SEQ_LOG, XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.
const char* seq_identify | ( | uint8 | info | ) |
void seq_mask | ( | char * | pagedata, |
BlockNumber | blkno | ||
) |
Definition at line 1950 of file sequence.c.
References mask_page_lsn_and_checksum(), and mask_unused_space().
void seq_redo | ( | XLogReaderState * | rptr | ) |
Definition at line 1882 of file sequence.c.
References BufferGetPage, BufferGetPageSize, elog, XLogReaderState::EndRecPtr, FirstOffsetNumber, InvalidOffsetNumber, sequence_magic::magic, MarkBufferDirty(), PageAddItem, PageGetSpecialPointer, PageInit(), PageSetLSN, palloc(), PANIC, pfree(), SEQ_MAGIC, UnlockReleaseBuffer(), XLOG_SEQ_LOG, XLogInitBufferForRedo(), XLogRecGetData, XLogRecGetDataLen, XLogRecGetInfo, and XLR_INFO_MASK.
Definition at line 1753 of file sequence.c.
References elog, ERROR, GETSTRUCT, HeapTupleIsValid, INT64_FORMAT, lappend(), makeDefElem(), makeFloat(), makeInteger(), NIL, options, psprintf(), ReleaseSysCache(), SearchSysCache1(), and SEQRELID.
Referenced by transformTableLikeClause().