PostgreSQL Source Code  git master
sequence.c File Reference
#include "postgres.h"
#include "access/relation.h"
#include "access/sequence.h"
#include "storage/lmgr.h"
Include dependency graph for sequence.c:

Go to the source code of this file.


static void validate_relation_kind (Relation r)
Relation sequence_open (Oid relationId, LOCKMODE lockmode)
void sequence_close (Relation relation, LOCKMODE lockmode)

Function Documentation

◆ sequence_close()

void sequence_close ( Relation  relation,
LOCKMODE  lockmode 

Definition at line 58 of file sequence.c.

59 {
60  relation_close(relation, lockmode);
61 }
void relation_close(Relation relation, LOCKMODE lockmode)
Definition: relation.c:205

References relation_close().

Referenced by AlterSequence(), currval_oid(), DefineSequence(), do_setval(), lastval(), nextval_internal(), pg_sequence_last_value(), ResetSequence(), and SequenceChangePersistence().

◆ sequence_open()

Relation sequence_open ( Oid  relationId,
LOCKMODE  lockmode 

Definition at line 37 of file sequence.c.

38 {
39  Relation r;
41  r = relation_open(relationId, lockmode);
45  return r;
46 }
static void validate_relation_kind(Relation r)
Definition: sequence.c:70
Relation relation_open(Oid relationId, LOCKMODE lockmode)
Definition: relation.c:47

References relation_open(), and validate_relation_kind().

Referenced by DefineSequence(), and lock_and_open_sequence().

◆ validate_relation_kind()

static void validate_relation_kind ( Relation  r)

Definition at line 70 of file sequence.c.

71 {
72  if (r->rd_rel->relkind != RELKIND_SEQUENCE)
73  ereport(ERROR,
75  errmsg("cannot open relation \"%s\"",
78 }
int errcode(int sqlerrcode)
Definition: elog.c:857
int errmsg(const char *fmt,...)
Definition: elog.c:1070
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:149
int errdetail_relkind_not_supported(char relkind)
Definition: pg_class.c:24
#define RelationGetRelationName(relation)
Definition: rel.h:539
Form_pg_class rd_rel
Definition: rel.h:111

References ereport, errcode(), errdetail_relkind_not_supported(), errmsg(), ERROR, RelationData::rd_rel, and RelationGetRelationName.

Referenced by sequence_open().