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/relfilelocator.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 *seq) |
ObjectAddress | AlterSequence (ParseState *pstate, AlterSeqStmt *stmt) |
void | SequenceChangePersistence (Oid relid, char newrelpersistence) |
void | DeleteSequenceTuple (Oid relid) |
void | ResetSequence (Oid seq_relid) |
void | ResetSequenceCaches (void) |
void | seq_redo (XLogReaderState *record) |
void | seq_desc (StringInfo buf, XLogReaderState *record) |
const char * | seq_identify (uint8 info) |
void | seq_mask (char *page, BlockNumber blkno) |
#define SEQ_COL_CALLED 3 |
Definition at line 40 of file sequence.h.
#define SEQ_COL_FIRSTCOL SEQ_COL_LASTVAL |
Definition at line 42 of file sequence.h.
#define SEQ_COL_LASTCOL SEQ_COL_CALLED |
Definition at line 43 of file sequence.h.
#define SEQ_COL_LASTVAL 1 |
Definition at line 38 of file sequence.h.
#define SEQ_COL_LOG 2 |
Definition at line 39 of file sequence.h.
#define XLOG_SEQ_LOG 0x00 |
Definition at line 46 of file sequence.h.
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 437 of file sequence.c.
References Assert, buf, SeqTableData::cached, CatalogTupleUpdate(), elog, ereport, errmsg(), ERROR, fill_seq_with_data(), GETSTRUCT, GetTopTransactionId(), heap_copytuple(), HeapTupleIsValid, init_params(), init_sequence(), InvalidMultiXactId, InvalidObjectAddress, InvalidOid, InvalidTransactionId, InvokeObjectPostAlterHook, SeqTableData::last, NoLock, NOTICE, ObjectAddressSet, ObjectIdGetDatum(), process_owned_by(), RangeVarCallbackOwnsRelation(), RangeVarGetRelidExtended(), RelationData::rd_rel, read_seq_tuple(), RelationNeedsWAL, RelationSetNewRelfilenumber(), RowExclusiveLock, RVR_MISSING_OK, SearchSysCacheCopy1, sequence_close(), ShareRowExclusiveLock, stmt, HeapTupleData::t_self, table_close(), table_open(), and UnlockReleaseBuffer().
Referenced by ProcessUtilitySlow().
ObjectAddress DefineSequence | ( | ParseState * | pstate, |
CreateSeqStmt * | seq | ||
) |
Definition at line 121 of file sequence.c.
References AccessExclusiveLock, Assert, BoolGetDatum(), CatalogTupleInsert(), checkMembershipInCurrentExtension(), DefineRelation(), ereport, errcode(), errmsg(), fill_seq_with_data(), CreateSeqStmt::for_identity, FormData_pg_sequence, heap_form_tuple(), heap_freetuple(), i, CreateSeqStmt::if_not_exists, init_params(), Int64GetDatum(), Int64GetDatumFast, InvalidObjectAddress, InvalidOid, ColumnDef::is_not_null, lappend(), FormData_pg_sequence_data::last_value, makeColumnDef(), makeNode, NIL, NoLock, NOTICE, ObjectAddressSet, ObjectAddress::objectId, ObjectIdGetDatum(), OidIsValid, ONCOMMIT_NOOP, CreateSeqStmt::options, CreateSeqStmt::ownerId, process_owned_by(), RangeVarGetAndCheckCreationNamespace(), RelationGetDescr, RangeVar::relname, RowExclusiveLock, SEQ_COL_CALLED, SEQ_COL_FIRSTCOL, SEQ_COL_LASTCOL, SEQ_COL_LASTVAL, SEQ_COL_LOG, CreateSeqStmt::sequence, sequence_close(), sequence_open(), stmt, table_close(), table_open(), and value.
Referenced by ProcessUtilitySlow().
void DeleteSequenceTuple | ( | Oid | relid | ) |
Definition at line 570 of file sequence.c.
References CatalogTupleDelete(), elog, ERROR, HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by doDeletion().
Datum nextval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 593 of file sequence.c.
References makeRangeVarFromNameList(), nextval_internal(), NoLock, PG_GETARG_TEXT_PP, PG_RETURN_INT64, RangeVarGetRelid, and textToQualifiedNameList().
Definition at line 623 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(), FormData_pg_sequence_data::is_called, SeqTableData::last, last_used_seq, SeqTableData::last_valid, FormData_pg_sequence_data::last_value, xl_seq_rec::locator, FormData_pg_sequence_data::log_cnt, MarkBufferDirty(), next, NoLock, ObjectIdGetDatum(), PageGetLSN(), PageSetLSN(), pg_class_aclcheck(), PreventCommandIfParallelMode(), PreventCommandIfReadOnly(), RelationData::rd_islocaltemp, RelationData::rd_locator, read_seq_tuple(), REGBUF_WILL_INIT, RelationGetRelationName, RelationNeedsWAL, ReleaseSysCache(), SeqTableData::relid, SearchSysCache1(), SEQ_LOG_VALS, sequence_close(), 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 262 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(), RelationSetNewRelfilenumber(), ReleaseSysCache(), SearchSysCache1(), sequence_close(), and UnlockReleaseBuffer().
Referenced by ExecuteTruncateGuts().
void ResetSequenceCaches | ( | void | ) |
Definition at line 1943 of file sequence.c.
References hash_destroy(), last_used_seq, and seqhashtab.
Referenced by DiscardAll(), and DiscardCommand().
void seq_desc | ( | StringInfo | buf, |
XLogReaderState * | record | ||
) |
Definition at line 21 of file seqdesc.c.
References appendStringInfo(), buf, RelFileLocator::dbOid, xl_seq_rec::locator, RelFileLocator::relNumber, RelFileLocator::spcOid, XLOG_SEQ_LOG, XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.
const char* seq_identify | ( | uint8 | info | ) |
void seq_mask | ( | char * | page, |
BlockNumber | blkno | ||
) |
Definition at line 1958 of file sequence.c.
References mask_page_lsn_and_checksum(), and mask_unused_space().
void seq_redo | ( | XLogReaderState * | record | ) |
Definition at line 1890 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 1707 of file sequence.c.
References elog, ERROR, GETSTRUCT, HeapTupleIsValid, INT64_FORMAT, lappend(), makeBoolean(), makeDefElem(), makeFloat(), NIL, ObjectIdGetDatum(), options, psprintf(), ReleaseSysCache(), and SearchSysCache1().
Referenced by transformTableLikeClause().
void SequenceChangePersistence | ( | Oid | relid, |
char | newrelpersistence | ||
) |
Definition at line 541 of file sequence.c.
References AccessExclusiveLock, buf, fill_seq_with_data(), GetTopTransactionId(), init_sequence(), LockRelationOid(), NoLock, read_seq_tuple(), RelationNeedsWAL, RelationSetNewRelfilenumber(), sequence_close(), and UnlockReleaseBuffer().
Referenced by ATRewriteTables().