diff options
Diffstat (limited to 'src/include')
477 files changed, 11729 insertions, 4522 deletions
diff --git a/src/include/.gitignore b/src/include/.gitignore index fa285a1605..49d108dbed 100644 --- a/src/include/.gitignore +++ b/src/include/.gitignore @@ -1,5 +1,6 @@ /stamp-h +/stamp-ext-h /pg_config.h +/pg_config_ext.h /pg_config_os.h /dynloader.h - diff --git a/src/include/Makefile b/src/include/Makefile index 74de25eb3e..62e54a3be1 100644 --- a/src/include/Makefile +++ b/src/include/Makefile @@ -13,24 +13,25 @@ top_builddir = ../.. include $(top_builddir)/src/Makefile.global -all: pg_config.h pg_config_os.h +all: pg_config.h pg_config_ext.h pg_config_os.h # Subdirectories containing headers for server-side dev -SUBDIRS = access bootstrap catalog commands datatype executor foreign lib libpq mb \ - nodes optimizer parser pgxc postmaster regex replication rewrite storage \ - tcop snowball snowball/libstemmer tsearch tsearch/dicts utils \ - port port/win32 port/win32_msvc port/win32_msvc/sys \ - port/win32/arpa port/win32/netinet port/win32/sys \ - portability gtm +SUBDIRS = access bootstrap catalog commands common datatype executor foreign \ + lib libpq mb nodes optimizer parser postmaster regex replication \ + rewrite storage tcop snowball snowball/libstemmer tsearch \ + tsearch/dicts utils port port/win32 port/win32_msvc \ + port/win32_msvc/sys port/win32/arpa port/win32/netinet \ + port/win32/sys portability gtm # Install all headers install: all installdirs # These headers are needed by the public headers of the interfaces. $(INSTALL_DATA) $(srcdir)/postgres_ext.h '$(DESTDIR)$(includedir)' $(INSTALL_DATA) $(srcdir)/libpq/libpq-fs.h '$(DESTDIR)$(includedir)/libpq' - $(INSTALL_DATA) pg_config.h '$(DESTDIR)$(includedir)' - $(INSTALL_DATA) pg_config_os.h '$(DESTDIR)$(includedir)' + $(INSTALL_DATA) pg_config.h '$(DESTDIR)$(includedir)' + $(INSTALL_DATA) pg_config_ext.h '$(DESTDIR)$(includedir)' + $(INSTALL_DATA) pg_config_os.h '$(DESTDIR)$(includedir)' $(INSTALL_DATA) $(srcdir)/pg_config_manual.h '$(DESTDIR)$(includedir)' # These headers are needed by the not-so-public headers of the interfaces. $(INSTALL_DATA) $(srcdir)/c.h '$(DESTDIR)$(includedir_internal)' @@ -38,8 +39,9 @@ install: all installdirs $(INSTALL_DATA) $(srcdir)/postgres_fe.h '$(DESTDIR)$(includedir_internal)' $(INSTALL_DATA) $(srcdir)/libpq/pqcomm.h '$(DESTDIR)$(includedir_internal)/libpq' # These headers are needed for server-side development - $(INSTALL_DATA) pg_config.h '$(DESTDIR)$(includedir_server)' - $(INSTALL_DATA) pg_config_os.h '$(DESTDIR)$(includedir_server)' + $(INSTALL_DATA) pg_config.h '$(DESTDIR)$(includedir_server)' + $(INSTALL_DATA) pg_config_ext.h '$(DESTDIR)$(includedir_server)' + $(INSTALL_DATA) pg_config_os.h '$(DESTDIR)$(includedir_server)' $(INSTALL_DATA) utils/errcodes.h '$(DESTDIR)$(includedir_server)/utils' $(INSTALL_DATA) utils/fmgroids.h '$(DESTDIR)$(includedir_server)/utils' # We don't use INSTALL_DATA for performance reasons --- there are a lot of files @@ -62,7 +64,7 @@ installdirs: uninstall: - rm -f $(addprefix '$(DESTDIR)$(includedir)'/, pg_config.h pg_config_os.h pg_config_manual.h postgres_ext.h libpq/libpq-fs.h) + rm -f $(addprefix '$(DESTDIR)$(includedir)'/, pg_config.h pg_config_ext.h pg_config_os.h pg_config_manual.h postgres_ext.h libpq/libpq-fs.h) rm -f $(addprefix '$(DESTDIR)$(includedir_internal)'/, c.h port.h postgres_fe.h libpq/pqcomm.h) # heuristic... rm -rf $(addprefix '$(DESTDIR)$(includedir_server)'/, $(SUBDIRS) *.h) @@ -72,7 +74,4 @@ clean: rm -f utils/fmgroids.h utils/errcodes.h parser/gram.h utils/probes.h catalog/schemapg.h distclean maintainer-clean: clean - rm -f pg_config.h dynloader.h pg_config_os.h stamp-h - -maintainer-check: - cd catalog && ./duplicate_oids + rm -f pg_config.h pg_config_ext.h pg_config_os.h dynloader.h stamp-h stamp-ext-h diff --git a/src/include/access/attnum.h b/src/include/access/attnum.h index 80a5faf4c7..ae7be34e81 100644 --- a/src/include/access/attnum.h +++ b/src/include/access/attnum.h @@ -4,7 +4,7 @@ * POSTGRES attribute number definitions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/attnum.h @@ -16,7 +16,7 @@ /* - * user defined attribute numbers start at 1. -ay 2/95 + * user defined attribute numbers start at 1. -ay 2/95 */ typedef int16 AttrNumber; diff --git a/src/include/access/clog.h b/src/include/access/clog.h index bed3b8cf26..66a6d17f18 100644 --- a/src/include/access/clog.h +++ b/src/include/access/clog.h @@ -3,7 +3,7 @@ * * PostgreSQL transaction-commit-log manager * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/clog.h diff --git a/src/include/access/genam.h b/src/include/access/genam.h index ec18976d43..d99158fb39 100644 --- a/src/include/access/genam.h +++ b/src/include/access/genam.h @@ -4,7 +4,7 @@ * POSTGRES generalized index access method definitions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/genam.h @@ -91,7 +91,7 @@ typedef struct SysScanDescData *SysScanDesc; * blocking to see if a conflicting transaction commits. * * For deferrable unique constraints, UNIQUE_CHECK_PARTIAL is specified at - * insertion time. The index AM should test if the tuple is unique, but + * insertion time. The index AM should test if the tuple is unique, but * should not throw error, block, or prevent the insertion if the tuple * appears not to be unique. We'll recheck later when it is time for the * constraint to be enforced. The AM must return true if the tuple is @@ -100,7 +100,7 @@ typedef struct SysScanDescData *SysScanDesc; * * When it is time to recheck the deferred constraint, a pseudo-insertion * call is made with UNIQUE_CHECK_EXISTING. The tuple is already in the - * index in this case, so it should not be inserted again. Rather, just + * index in this case, so it should not be inserted again. Rather, just * check for conflicting live tuples (possibly blocking). */ typedef enum IndexUniqueCheck diff --git a/src/include/access/gin.h b/src/include/access/gin.h index 36e490a6f3..4cda0ecbab 100644 --- a/src/include/access/gin.h +++ b/src/include/access/gin.h @@ -2,7 +2,7 @@ * gin.h * Public header file for Generalized Inverted Index access method. * - * Copyright (c) 2006-2012, PostgreSQL Global Development Group + * Copyright (c) 2006-2014, PostgreSQL Global Development Group * * src/include/access/gin.h *-------------------------------------------------------------------------- @@ -23,7 +23,8 @@ #define GIN_EXTRACTQUERY_PROC 3 #define GIN_CONSISTENT_PROC 4 #define GIN_COMPARE_PARTIAL_PROC 5 -#define GINNProcs 5 +#define GIN_TRICONSISTENT_PROC 6 +#define GINNProcs 6 /* * searchMode settings for extractQueryFn. @@ -46,6 +47,23 @@ typedef struct GinStatsData int32 ginVersion; } GinStatsData; +/* + * A ternary value used by tri-consistent functions. + * + * For convenience, this is compatible with booleans. A boolean can be + * safely cast to a GinTernaryValue. + */ +typedef char GinTernaryValue; + +#define GIN_FALSE 0 /* item is not present / does not match */ +#define GIN_TRUE 1 /* item is present / matches */ +#define GIN_MAYBE 2 /* don't know if item is present / don't know + * if matches */ + +#define DatumGetGinTernaryValue(X) ((GinTernaryValue)(X)) +#define GinTernaryValueGetDatum(X) ((Datum)(X)) +#define PG_RETURN_GIN_TERNARY_VALUE(x) return GinTernaryValueGetDatum(x) + /* GUC parameter */ extern PGDLLIMPORT int GinFuzzySearchLimit; @@ -58,6 +76,5 @@ extern void gin_redo(XLogRecPtr lsn, XLogRecord *record); extern void gin_desc(StringInfo buf, uint8 xl_info, char *rec); extern void gin_xlog_startup(void); extern void gin_xlog_cleanup(void); -extern bool gin_safe_restartpoint(void); #endif /* GIN_H */ diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h index e56a92358c..3baa9f5e1a 100644 --- a/src/include/access/gin_private.h +++ b/src/include/access/gin_private.h @@ -2,7 +2,7 @@ * gin_private.h * header file for postgres inverted index access method implementation. * - * Copyright (c) 2006-2012, PostgreSQL Global Development Group + * Copyright (c) 2006-2014, PostgreSQL Global Development Group * * src/include/access/gin_private.h *-------------------------------------------------------------------------- @@ -19,7 +19,7 @@ /* - * Page opaque data in a inverted index page. + * Page opaque data in an inverted index page. * * Note: GIN does not include a page ID word as do the other index types. * This is OK because the opaque data is only 8 bytes and so can be reliably @@ -32,9 +32,7 @@ typedef struct GinPageOpaqueData { BlockNumber rightlink; /* next page if any */ - OffsetNumber maxoff; /* number entries on GIN_DATA page: number of - * heap ItemPointers on GIN_DATA|GIN_LEAF page - * or number of PostingItems on GIN_DATA & + OffsetNumber maxoff; /* number of PostingItems on GIN_DATA & * ~GIN_LEAF page. On GIN_LIST page, number of * heap tuples. */ uint16 flags; /* see bit definitions below */ @@ -48,6 +46,9 @@ typedef GinPageOpaqueData *GinPageOpaque; #define GIN_META (1 << 3) #define GIN_LIST (1 << 4) #define GIN_LIST_FULLROW (1 << 5) /* makes sense only on GIN_LIST page */ +#define GIN_INCOMPLETE_SPLIT (1 << 6) /* page was split, but parent not + * updated */ +#define GIN_COMPRESSED (1 << 7) /* Page numbers of fixed-location pages */ #define GIN_METAPAGE_BLKNO (0) @@ -87,7 +88,12 @@ typedef struct GinMetaPageData * GIN version number (ideally this should have been at the front, but too * late now. Don't move it!) * - * Currently 1 (for indexes initialized in 9.1 or later) + * Currently 2 (for indexes initialized in 9.4 or later) + * + * Version 1 (indexes initialized in version 9.1, 9.2 or 9.3), is + * compatible, but may contain uncompressed posting tree (leaf) pages and + * posting lists. They will be converted to compressed format when + * modified. * * Version 0 (indexes initialized in 9.0 or before) is compatible but may * be missing null entries, including both null keys and placeholders. @@ -96,7 +102,7 @@ typedef struct GinMetaPageData int32 ginVersion; } GinMetaPageData; -#define GIN_CURRENT_VERSION 1 +#define GIN_CURRENT_VERSION 2 #define GinPageGetMeta(p) \ ((GinMetaPageData *) PageGetContents(p)) @@ -115,15 +121,18 @@ typedef struct GinMetaPageData #define GinPageSetList(page) ( GinPageGetOpaque(page)->flags |= GIN_LIST ) #define GinPageHasFullRow(page) ( GinPageGetOpaque(page)->flags & GIN_LIST_FULLROW ) #define GinPageSetFullRow(page) ( GinPageGetOpaque(page)->flags |= GIN_LIST_FULLROW ) +#define GinPageIsCompressed(page) ( GinPageGetOpaque(page)->flags & GIN_COMPRESSED ) +#define GinPageSetCompressed(page) ( GinPageGetOpaque(page)->flags |= GIN_COMPRESSED ) #define GinPageIsDeleted(page) ( GinPageGetOpaque(page)->flags & GIN_DELETED) #define GinPageSetDeleted(page) ( GinPageGetOpaque(page)->flags |= GIN_DELETED) #define GinPageSetNonDeleted(page) ( GinPageGetOpaque(page)->flags &= ~GIN_DELETED) +#define GinPageIsIncompleteSplit(page) ( GinPageGetOpaque(page)->flags & GIN_INCOMPLETE_SPLIT) #define GinPageRightMost(page) ( GinPageGetOpaque(page)->rightlink == InvalidBlockNumber) /* - * We use our own ItemPointerGet(BlockNumber|GetOffsetNumber) + * We use our own ItemPointerGet(BlockNumber|OffsetNumber) * to avoid Asserts, since sometimes the ip_posid isn't "valid" */ #define GinItemPointerGetBlockNumber(pointer) \ @@ -195,7 +204,7 @@ typedef signed char GinNullCategory; */ #define GinCategoryOffset(itup,ginstate) \ (IndexInfoFindDataOffset((itup)->t_info) + \ - ((ginstate)->oneCol ? 0 : sizeof(int2))) + ((ginstate)->oneCol ? 0 : sizeof(int16))) #define GinGetNullCategory(itup,ginstate) \ (*((GinNullCategory *) ((char*)(itup) + GinCategoryOffset(itup,ginstate)))) #define GinSetNullCategory(itup,ginstate,c) \ @@ -211,13 +220,16 @@ typedef signed char GinNullCategory; #define GinSetPostingTree(itup, blkno) ( GinSetNPosting((itup),GIN_TREE_POSTING), ItemPointerSetBlockNumber(&(itup)->t_tid, blkno) ) #define GinGetPostingTree(itup) GinItemPointerGetBlockNumber(&(itup)->t_tid) -#define GinGetPostingOffset(itup) GinItemPointerGetBlockNumber(&(itup)->t_tid) -#define GinSetPostingOffset(itup,n) ItemPointerSetBlockNumber(&(itup)->t_tid,n) -#define GinGetPosting(itup) ((ItemPointer) ((char*)(itup) + GinGetPostingOffset(itup))) +#define GIN_ITUP_COMPRESSED (1 << 31) +#define GinGetPostingOffset(itup) (GinItemPointerGetBlockNumber(&(itup)->t_tid) & (~GIN_ITUP_COMPRESSED)) +#define GinSetPostingOffset(itup,n) ItemPointerSetBlockNumber(&(itup)->t_tid,(n)|GIN_ITUP_COMPRESSED) +#define GinGetPosting(itup) ((Pointer) ((char*)(itup) + GinGetPostingOffset(itup))) +#define GinItupIsCompressed(itup) (GinItemPointerGetBlockNumber(&(itup)->t_tid) & GIN_ITUP_COMPRESSED) #define GinMaxItemSize \ - MAXALIGN_DOWN(((BLCKSZ - SizeOfPageHeaderData - \ - MAXALIGN(sizeof(GinPageOpaqueData))) / 3 - sizeof(ItemIdData))) + Min(INDEX_SIZE_MASK, \ + MAXALIGN_DOWN(((BLCKSZ - SizeOfPageHeaderData - \ + MAXALIGN(sizeof(GinPageOpaqueData))) / 6 - sizeof(ItemIdData)))) /* * Access macros for non-leaf entry tuples @@ -228,27 +240,67 @@ typedef signed char GinNullCategory; /* * Data (posting tree) pages + * + * Posting tree pages don't store regular tuples. Non-leaf pages contain + * PostingItems, which are pairs of ItemPointers and child block numbers. + * Leaf pages contain GinPostingLists and an uncompressed array of item + * pointers. + * + * In a leaf page, the compressed posting lists are stored after the regular + * page header, one after each other. Although we don't store regular tuples, + * pd_lower is used to indicate the end of the posting lists. After that, free + * space follows. This layout is compatible with the "standard" heap and + * index page layout described in bufpage.h, so that we can e.g set buffer_std + * when writing WAL records. + * + * In the special space is the GinPageOpaque struct. */ +#define GinDataLeafPageGetPostingList(page) \ + (GinPostingList *) ((PageGetContents(page) + MAXALIGN(sizeof(ItemPointerData)))) +#define GinDataLeafPageGetPostingListSize(page) \ + (((PageHeader) page)->pd_lower - MAXALIGN(SizeOfPageHeaderData) - MAXALIGN(sizeof(ItemPointerData))) + +#define GinDataLeafPageIsEmpty(page) \ + (GinPageIsCompressed(page) ? (GinDataLeafPageGetPostingListSize(page) == 0) : (GinPageGetOpaque(page)->maxoff < FirstOffsetNumber)) + +#define GinDataLeafPageGetFreeSpace(page) PageGetExactFreeSpace(page) + #define GinDataPageGetRightBound(page) ((ItemPointer) PageGetContents(page)) +/* + * Pointer to the data portion of a posting tree page. For internal pages, + * that's the beginning of the array of PostingItems. For compressed leaf + * pages, the first compressed posting list. For uncompressed (pre-9.4) leaf + * pages, it's the beginning of the ItemPointer array. + */ #define GinDataPageGetData(page) \ (PageGetContents(page) + MAXALIGN(sizeof(ItemPointerData))) -#define GinSizeOfDataPageItem(page) \ - (GinPageIsLeaf(page) ? sizeof(ItemPointerData) : sizeof(PostingItem)) -#define GinDataPageGetItem(page,i) \ - (GinDataPageGetData(page) + ((i)-1) * GinSizeOfDataPageItem(page)) +/* non-leaf pages contain PostingItems */ +#define GinDataPageGetPostingItem(page, i) \ + ((PostingItem *) (GinDataPageGetData(page) + ((i)-1) * sizeof(PostingItem))) + +/* + * Note: there is no GinDataPageGetDataSize macro, because before version + * 9.4, we didn't set pd_lower on data pages. There can be pages in the index + * that were binary-upgraded from earlier versions and still have an invalid + * pd_lower, so we cannot trust it in general. Compressed posting tree leaf + * pages are new in 9.4, however, so we can trust them; see + * GinDataLeafPageGetPostingListSize. + */ +#define GinDataPageSetDataSize(page, size) \ + { \ + Assert(size <= GinDataPageMaxDataSize); \ + ((PageHeader) page)->pd_lower = (size) + MAXALIGN(SizeOfPageHeaderData) + MAXALIGN(sizeof(ItemPointerData)); \ + } -#define GinDataPageGetFreeSpace(page) \ +#define GinNonLeafDataPageGetFreeSpace(page) \ + (GinDataPageMaxDataSize - \ + GinPageGetOpaque(page)->maxoff * sizeof(PostingItem)) + +#define GinDataPageMaxDataSize \ (BLCKSZ - MAXALIGN(SizeOfPageHeaderData) \ - MAXALIGN(sizeof(ItemPointerData)) \ - - GinPageGetOpaque(page)->maxoff * GinSizeOfDataPageItem(page) \ - MAXALIGN(sizeof(GinPageOpaqueData))) -#define GinMaxLeafDataItems \ - ((BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - \ - MAXALIGN(sizeof(ItemPointerData)) - \ - MAXALIGN(sizeof(GinPageOpaqueData))) \ - / sizeof(ItemPointerData)) - /* * List pages */ @@ -305,6 +357,7 @@ typedef struct GinState FmgrInfo extractValueFn[INDEX_MAX_KEYS]; FmgrInfo extractQueryFn[INDEX_MAX_KEYS]; FmgrInfo consistentFn[INDEX_MAX_KEYS]; + FmgrInfo triConsistentFn[INDEX_MAX_KEYS]; FmgrInfo comparePartialFn[INDEX_MAX_KEYS]; /* optional method */ /* canPartialMatch[i] is true if comparePartialFn[i] is valid */ bool canPartialMatch[INDEX_MAX_KEYS]; @@ -312,6 +365,23 @@ typedef struct GinState Oid supportCollation[INDEX_MAX_KEYS]; } GinState; + +/* + * A compressed posting list. + * + * Note: This requires 2-byte alignment. + */ +typedef struct +{ + ItemPointerData first; /* first item in this posting list (unpacked) */ + uint16 nbytes; /* number of bytes that follow */ + unsigned char bytes[1]; /* varbyte encoded items (variable length) */ +} GinPostingList; + +#define SizeOfGinPostingList(plist) (offsetof(GinPostingList, bytes) + SHORTALIGN((plist)->nbytes) ) +#define GinNextPostingListSegment(cur) ((GinPostingList *) (((char *) (cur)) + SizeOfGinPostingList((cur)))) + + /* XLog stuff */ #define XLOG_GIN_CREATE_INDEX 0x00 @@ -322,28 +392,84 @@ typedef struct ginxlogCreatePostingTree { RelFileNode node; BlockNumber blkno; - uint32 nitem; - /* follows list of heap's ItemPointer */ + uint32 size; + /* A compressed posting list follows */ } ginxlogCreatePostingTree; #define XLOG_GIN_INSERT 0x20 -typedef struct ginxlogInsert +/* + * The format of the insertion record varies depending on the page type. + * ginxlogInsert is the common part between all variants. + */ +typedef struct { RelFileNode node; BlockNumber blkno; - BlockNumber updateBlkno; + uint16 flags; /* GIN_SPLIT_ISLEAF and/or GIN_SPLIT_ISDATA */ + + /* + * FOLLOWS: + * + * 1. if not leaf page, block numbers of the left and right child pages + * whose split this insertion finishes. As BlockIdData[2] (beware of + * adding fields before this that would make them not 16-bit aligned) + * + * 2. an ginxlogInsertEntry or ginxlogRecompressDataLeaf struct, depending + * on tree type. + * + * NB: the below structs are only 16-bit aligned when appended to a + * ginxlogInsert struct! Beware of adding fields to them that require + * stricter alignment. + */ +} ginxlogInsert; + +typedef struct +{ OffsetNumber offset; bool isDelete; - bool isData; - bool isLeaf; - OffsetNumber nitem; + IndexTupleData tuple; /* variable length */ +} ginxlogInsertEntry; + + +typedef struct +{ + uint16 nactions; + + /* Variable number of 'actions' follow */ +} ginxlogRecompressDataLeaf; + +/* + * Note: this struct is currently not used in code, and only acts as + * documentation. The WAL record format is as specified here, but the code + * uses straight access through a Pointer and memcpy to read/write these. + */ +typedef struct +{ + uint8 segno; /* segment this action applies to */ + char type; /* action type (see below) */ /* - * follows: tuples or ItemPointerData or PostingItem or list of - * ItemPointerData + * Action-specific data follows. For INSERT and REPLACE actions that is a + * GinPostingList struct. For ADDITEMS, a uint16 for the number of items + * added, followed by the items themselves as ItemPointers. DELETE actions + * have no further data. */ -} ginxlogInsert; +} ginxlogSegmentAction; + +/* Action types */ +#define GIN_SEGMENT_UNMODIFIED 0 /* no action (not used in WAL records) */ +#define GIN_SEGMENT_DELETE 1 /* a whole segment is removed */ +#define GIN_SEGMENT_INSERT 2 /* a whole segment is added */ +#define GIN_SEGMENT_REPLACE 3 /* a segment is replaced */ +#define GIN_SEGMENT_ADDITEMS 4 /* items are added to existing segment */ + +typedef struct +{ + OffsetNumber offset; + PostingItem newitem; +} ginxlogInsertDataInternal; + #define XLOG_GIN_SPLIT 0x30 @@ -351,33 +477,83 @@ typedef struct ginxlogSplit { RelFileNode node; BlockNumber lblkno; - BlockNumber rootBlkno; BlockNumber rblkno; - BlockNumber rrlink; + BlockNumber rrlink; /* right link, or root's blocknumber if root + * split */ + BlockNumber leftChildBlkno; /* valid on a non-leaf split */ + BlockNumber rightChildBlkno; + uint16 flags; + + /* follows: one of the following structs */ +} ginxlogSplit; + +/* + * Flags used in ginxlogInsert and ginxlogSplit records + */ +#define GIN_INSERT_ISDATA 0x01 /* for both insert and split records */ +#define GIN_INSERT_ISLEAF 0x02 /* .. */ +#define GIN_SPLIT_ROOT 0x04 /* only for split records */ + +typedef struct +{ OffsetNumber separator; OffsetNumber nitem; - bool isData; - bool isLeaf; - bool isRootSplit; + /* FOLLOWS: IndexTuples */ +} ginxlogSplitEntry; + +typedef struct +{ + uint16 lsize; + uint16 rsize; + ItemPointerData lrightbound; /* new right bound of left page */ + ItemPointerData rrightbound; /* new right bound of right page */ - BlockNumber leftChildBlkno; - BlockNumber updateBlkno; + /* FOLLOWS: new compressed posting lists of left and right page */ + char newdata[1]; +} ginxlogSplitDataLeaf; - ItemPointerData rightbound; /* used only in posting tree */ - /* follows: list of tuple or ItemPointerData or PostingItem */ -} ginxlogSplit; +typedef struct +{ + OffsetNumber separator; + OffsetNumber nitem; + ItemPointerData rightbound; + /* FOLLOWS: array of PostingItems */ +} ginxlogSplitDataInternal; + +/* + * Vacuum simply WAL-logs the whole page, when anything is modified. This + * functionally identical heap_newpage records, but is kept separate for + * debugging purposes. (When inspecting the WAL stream, it's easier to see + * what's going on when GIN vacuum records are marked as such, not as heap + * records.) This is currently only used for entry tree leaf pages. + */ #define XLOG_GIN_VACUUM_PAGE 0x40 typedef struct ginxlogVacuumPage { RelFileNode node; BlockNumber blkno; - OffsetNumber nitem; - /* follows content of page */ + uint16 hole_offset; /* number of bytes before "hole" */ + uint16 hole_length; /* number of bytes in "hole" */ + /* entire page contents (minus the hole) follow at end of record */ } ginxlogVacuumPage; +/* + * Vacuuming posting tree leaf page is WAL-logged like recompression caused + * by insertion. + */ +#define XLOG_GIN_VACUUM_DATA_LEAF_PAGE 0x90 + +typedef struct ginxlogVacuumDataLeafPage +{ + RelFileNode node; + BlockNumber blkno; + + ginxlogRecompressDataLeaf data; +} ginxlogVacuumDataLeafPage; + #define XLOG_GIN_DELETE_PAGE 0x50 typedef struct ginxlogDeletePage @@ -464,6 +640,7 @@ typedef struct GinBtreeStack BlockNumber blkno; Buffer buffer; OffsetNumber off; + ItemPointerData iptr; /* predictNumber contains predicted number of pages on current level */ uint32 predictNumber; struct GinBtreeStack *parent; @@ -471,87 +648,108 @@ typedef struct GinBtreeStack typedef struct GinBtreeData *GinBtree; +/* Return codes for GinBtreeData.placeToPage method */ +typedef enum +{ + UNMODIFIED, + INSERTED, + SPLIT +} GinPlaceToPageRC; + typedef struct GinBtreeData { /* search methods */ BlockNumber (*findChildPage) (GinBtree, GinBtreeStack *); + BlockNumber (*getLeftMostChild) (GinBtree, Page); bool (*isMoveRight) (GinBtree, Page); bool (*findItem) (GinBtree, GinBtreeStack *); /* insert methods */ OffsetNumber (*findChildPtr) (GinBtree, Page, BlockNumber, OffsetNumber); - BlockNumber (*getLeftMostPage) (GinBtree, Page); - bool (*isEnoughSpace) (GinBtree, Buffer, OffsetNumber); - void (*placeToPage) (GinBtree, Buffer, OffsetNumber, XLogRecData **); - Page (*splitPage) (GinBtree, Buffer, Buffer, OffsetNumber, XLogRecData **); - void (*fillRoot) (GinBtree, Buffer, Buffer, Buffer); + GinPlaceToPageRC (*placeToPage) (GinBtree, Buffer, GinBtreeStack *, void *, BlockNumber, XLogRecData **, Page *, Page *); + void *(*prepareDownlink) (GinBtree, Buffer); + void (*fillRoot) (GinBtree, Page, BlockNumber, Page, BlockNumber, Page); bool isData; - bool searchMode; Relation index; + BlockNumber rootBlkno; GinState *ginstate; /* not valid in a data scan */ bool fullScan; bool isBuild; - BlockNumber rightblkno; - - /* Entry options */ + /* Search key for Entry tree */ OffsetNumber entryAttnum; Datum entryKey; GinNullCategory entryCategory; - IndexTuple entry; - bool isDelete; - /* Data (posting tree) options */ + /* Search key for data tree (posting tree) */ + ItemPointerData itemptr; +} GinBtreeData; + +/* This represents a tuple to be inserted to entry tree. */ +typedef struct +{ + IndexTuple entry; /* tuple to insert */ + bool isDelete; /* delete old tuple at same offset? */ +} GinBtreeEntryInsertData; + +/* + * This represents an itempointer, or many itempointers, to be inserted to + * a data (posting tree) leaf page + */ +typedef struct +{ ItemPointerData *items; uint32 nitem; uint32 curitem; +} GinBtreeDataLeafInsertData; - PostingItem pitem; -} GinBtreeData; +/* + * For internal data (posting tree) pages, the insertion payload is a + * PostingItem + */ -extern GinBtreeStack *ginPrepareFindLeafPage(GinBtree btree, BlockNumber blkno); -extern GinBtreeStack *ginFindLeafPage(GinBtree btree, GinBtreeStack *stack); +extern GinBtreeStack *ginFindLeafPage(GinBtree btree, bool searchMode); +extern Buffer ginStepRight(Buffer buffer, Relation index, int lockmode); extern void freeGinBtreeStack(GinBtreeStack *stack); extern void ginInsertValue(GinBtree btree, GinBtreeStack *stack, - GinStatsData *buildStats); -extern void ginFindParents(GinBtree btree, GinBtreeStack *stack, BlockNumber rootBlkno); + void *insertdata, GinStatsData *buildStats); /* ginentrypage.c */ extern IndexTuple GinFormTuple(GinState *ginstate, OffsetNumber attnum, Datum key, GinNullCategory category, - ItemPointerData *ipd, uint32 nipd, bool errorTooBig); -extern void GinShortenTuple(IndexTuple itup, uint32 nipd); + Pointer data, Size dataSize, int nipd, bool errorTooBig); extern void ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum, Datum key, GinNullCategory category, GinState *ginstate); -extern void ginEntryFillRoot(GinBtree btree, Buffer root, Buffer lbuf, Buffer rbuf); -extern IndexTuple ginPageGetLinkItup(Buffer buf); +extern void ginEntryFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage); +extern ItemPointer ginReadTuple(GinState *ginstate, OffsetNumber attnum, + IndexTuple itup, int *nitems); /* gindatapage.c */ -extern int ginCompareItemPointers(ItemPointer a, ItemPointer b); -extern uint32 ginMergeItemPointers(ItemPointerData *dst, - ItemPointerData *a, uint32 na, - ItemPointerData *b, uint32 nb); - -extern void GinDataPageAddItem(Page page, void *data, OffsetNumber offset); +extern ItemPointer GinDataLeafPageGetItems(Page page, int *nitems, ItemPointerData advancePast); +extern int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm); +extern BlockNumber createPostingTree(Relation index, + ItemPointerData *items, uint32 nitems, + GinStatsData *buildStats); +extern void GinDataPageAddPostingItem(Page page, PostingItem *data, OffsetNumber offset); extern void GinPageDeletePostingItem(Page page, OffsetNumber offset); - -typedef struct -{ - GinBtreeData btree; - GinBtreeStack *stack; -} GinPostingTreeScan; - -extern GinPostingTreeScan *ginPrepareScanPostingTree(Relation index, - BlockNumber rootBlkno, bool searchMode); -extern void ginInsertItemPointers(GinPostingTreeScan *gdi, +extern void ginInsertItemPointers(Relation index, BlockNumber rootBlkno, ItemPointerData *items, uint32 nitem, GinStatsData *buildStats); -extern Buffer ginScanBeginPostingTree(GinPostingTreeScan *gdi); -extern void ginDataFillRoot(GinBtree btree, Buffer root, Buffer lbuf, Buffer rbuf); -extern void ginPrepareDataScan(GinBtree btree, Relation index); +extern GinBtreeStack *ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno); +extern void ginDataFillRoot(GinBtree btree, Page root, BlockNumber lblkno, Page lpage, BlockNumber rblkno, Page rpage); +extern void ginPrepareDataScan(GinBtree btree, Relation index, BlockNumber rootBlkno); + +/* + * This is declared in ginvacuum.c, but is passed between ginVacuumItemPointers + * and ginVacuumPostingTreeLeaf and as an opaque struct, so we need a forward + * declaration for it. + */ +typedef struct GinVacuumState GinVacuumState; + +extern void ginVacuumPostingTreeLeaf(Relation rel, Buffer buf, GinVacuumState *gvs); /* ginscan.c */ @@ -568,7 +766,7 @@ extern void ginPrepareDataScan(GinBtree btree, Relation index); * * In each GinScanKeyData, nentries is the true number of entries, while * nuserentries is the number that extractQueryFn returned (which is what - * we report to consistentFn). The "user" entries must come first. + * we report to consistentFn). The "user" entries must come first. */ typedef struct GinScanKeyData *GinScanKey; @@ -584,8 +782,26 @@ typedef struct GinScanKeyData /* array of GinScanEntry pointers, one per extracted search condition */ GinScanEntry *scanEntry; + /* + * At least one of the entries in requiredEntries must be present for a + * tuple to match the overall qual. + * + * additionalEntries contains entries that are needed by the consistent + * function to decide if an item matches, but are not sufficient to + * satisfy the qual without entries from requiredEntries. + */ + GinScanEntry *requiredEntries; + int nrequired; + GinScanEntry *additionalEntries; + int nadditional; + /* array of check flags, reported to consistentFn */ bool *entryRes; + bool (*boolConsistentFn) (GinScanKey key); + GinTernaryValue (*triConsistentFn) (GinScanKey key); + FmgrInfo *consistentFmgrInfo; + FmgrInfo *triConsistentFmgrInfo; + Oid collation; /* other data needed for calling consistentFn */ Datum query; @@ -634,12 +850,13 @@ typedef struct GinScanEntryData /* used for Posting list and one page in Posting tree */ ItemPointerData *list; - uint32 nlist; + int nlist; OffsetNumber offset; bool isFinished; bool reduceResult; uint32 predictNumberResult; + GinBtreeData btree; } GinScanEntryData; typedef struct GinScanOpaqueData @@ -669,9 +886,14 @@ extern void ginNewScanKey(IndexScanDesc scan); /* ginget.c */ extern Datum gingetbitmap(PG_FUNCTION_ARGS); +/* ginlogic.c */ +extern void ginInitConsistentFunction(GinState *ginstate, GinScanKey key); + /* ginvacuum.c */ extern Datum ginbulkdelete(PG_FUNCTION_ARGS); extern Datum ginvacuumcleanup(PG_FUNCTION_ARGS); +extern ItemPointer ginVacuumItemPointers(GinVacuumState *gvs, + ItemPointerData *items, int nitem, int *nremaining); /* ginbulk.c */ typedef struct GinEntryAccumulator @@ -724,4 +946,40 @@ extern void ginHeapTupleFastCollect(GinState *ginstate, extern void ginInsertCleanup(GinState *ginstate, bool vac_delay, IndexBulkDeleteResult *stats); +/* ginpostinglist.c */ + +extern GinPostingList *ginCompressPostingList(const ItemPointer ptrs, int nptrs, + int maxsize, int *nwritten); +extern int ginPostingListDecodeAllSegmentsToTbm(GinPostingList *ptr, int totalsize, TIDBitmap *tbm); + +extern ItemPointer ginPostingListDecodeAllSegments(GinPostingList *ptr, int len, int *ndecoded); +extern ItemPointer ginPostingListDecode(GinPostingList *ptr, int *ndecoded); +extern ItemPointer ginMergeItemPointers(ItemPointerData *a, uint32 na, + ItemPointerData *b, uint32 nb, + int *nmerged); + +/* + * Merging the results of several gin scans compares item pointers a lot, + * so we want this to be inlined. But if the compiler doesn't support that, + * fall back on the non-inline version from itemptr.c. See STATIC_IF_INLINE in + * c.h. + */ +#ifdef PG_USE_INLINE +static inline int +ginCompareItemPointers(ItemPointer a, ItemPointer b) +{ + uint64 ia = (uint64) a->ip_blkid.bi_hi << 32 | (uint64) a->ip_blkid.bi_lo << 16 | a->ip_posid; + uint64 ib = (uint64) b->ip_blkid.bi_hi << 32 | (uint64) b->ip_blkid.bi_lo << 16 | b->ip_posid; + + if (ia == ib) + return 0; + else if (ia > ib) + return 1; + else + return -1; +} +#else +#define ginCompareItemPointers(a, b) ItemPointerCompare(a, b) +#endif /* PG_USE_INLINE */ + #endif /* GIN_PRIVATE_H */ diff --git a/src/include/access/gist.h b/src/include/access/gist.h index ed57bb7f93..ef5aed4d3e 100644 --- a/src/include/access/gist.h +++ b/src/include/access/gist.h @@ -6,7 +6,7 @@ * changes should be made with care. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/gist.h @@ -65,9 +65,15 @@ typedef XLogRecPtr GistNSN; +/* + * For on-disk compatibility with pre-9.3 servers, NSN is stored as two + * 32-bit fields on disk, same as LSNs. + */ +typedef PageXLogRecPtr PageGistNSN; + typedef struct GISTPageOpaqueData { - GistNSN nsn; /* this value must change on page split */ + PageGistNSN nsn; /* this value must change on page split */ BlockNumber rightlink; /* next page if any */ uint16 flags; /* see bit definitions above */ uint16 gist_page_id; /* for identification of GiST indexes */ @@ -85,11 +91,30 @@ typedef GISTPageOpaqueData *GISTPageOpaque; /* * This is the Split Vector to be returned by the PickSplit method. - * PickSplit should check spl_(r|l)datum_exists. If it is 'true', - * that corresponding spl_(r|l)datum already defined and - * PickSplit should use that value. PickSplit should always set - * spl_(r|l)datum_exists to false: GiST will check value to - * control supporting this feature by PickSplit... + * PickSplit should fill the indexes of tuples to go to the left side into + * spl_left[], and those to go to the right into spl_right[] (note the method + * is responsible for palloc'ing both of these arrays!). The tuple counts + * go into spl_nleft/spl_nright, and spl_ldatum/spl_rdatum must be set to + * the union keys for each side. + * + * If spl_ldatum_exists and spl_rdatum_exists are true, then we are performing + * a "secondary split" using a non-first index column. In this case some + * decisions have already been made about a page split, and the set of tuples + * being passed to PickSplit is just the tuples about which we are undecided. + * spl_ldatum/spl_rdatum then contain the union keys for the tuples already + * chosen to go left or right. Ideally the PickSplit method should take those + * keys into account while deciding what to do with the remaining tuples, ie + * it should try to "build out" from those unions so as to minimally expand + * them. If it does so, it should union the given tuples' keys into the + * existing spl_ldatum/spl_rdatum values rather than just setting those values + * from scratch, and then set spl_ldatum_exists/spl_rdatum_exists to false to + * show it has done this. + * + * If the PickSplit method fails to clear spl_ldatum_exists/spl_rdatum_exists, + * the core GiST code will make its own decision about how to merge the + * secondary-split results with the previously-chosen tuples, and will then + * recompute the union keys from scratch. This is a workable though often not + * optimal approach. */ typedef struct GIST_SPLITVEC { @@ -137,6 +162,9 @@ typedef struct GISTENTRY #define GistMarkFollowRight(page) ( GistPageGetOpaque(page)->flags |= F_FOLLOW_RIGHT) #define GistClearFollowRight(page) ( GistPageGetOpaque(page)->flags &= ~F_FOLLOW_RIGHT) +#define GistPageGetNSN(page) ( PageXLogRecPtrGet(GistPageGetOpaque(page)->nsn)) +#define GistPageSetNSN(page, val) ( PageXLogRecPtrSet(GistPageGetOpaque(page)->nsn, val)) + /* * Vector of GISTENTRY structs; user-defined methods union and picksplit * take it as one of their arguments diff --git a/src/include/access/gist_private.h b/src/include/access/gist_private.h index 9af9a0cf8c..089c679421 100644 --- a/src/include/access/gist_private.h +++ b/src/include/access/gist_private.h @@ -4,7 +4,7 @@ * private declarations for GiST -- declarations related to the * internal implementation of GiST, not the public API * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/gist_private.h @@ -22,6 +22,21 @@ #include "utils/rbtree.h" #include "utils/hsearch.h" +/* + * Maximum number of "halves" a page can be split into in one operation. + * Typically a split produces 2 halves, but can be more if keys have very + * different lengths, or when inserting multiple keys in one operation (as + * when inserting downlinks to an internal node). There is no theoretical + * limit on this, but in practice if you get more than a handful page halves + * in one split, there's something wrong with the opclass implementation. + * GIST_MAX_SPLIT_PAGES is an arbitrary limit on that, used to size some + * local arrays used during split. Note that there is also a limit on the + * number of buffers that can be held locked at a time, MAX_SIMUL_LWLOCKS, + * so if you raise this higher than that limit, you'll just get a different + * error. + */ +#define GIST_MAX_SPLIT_PAGES 75 + /* Buffer lock modes */ #define GIST_SHARE BUFFER_LOCK_SHARE #define GIST_EXCLUSIVE BUFFER_LOCK_EXCLUSIVE @@ -167,7 +182,7 @@ typedef GISTScanOpaqueData *GISTScanOpaque; #define XLOG_GIST_PAGE_SPLIT 0x30 /* #define XLOG_GIST_INSERT_COMPLETE 0x40 */ /* not used anymore */ #define XLOG_GIST_CREATE_INDEX 0x50 -#define XLOG_GIST_PAGE_DELETE 0x60 + /* #define XLOG_GIST_PAGE_DELETE 0x60 */ /* not used anymore */ typedef struct gistxlogPageUpdate { @@ -211,12 +226,6 @@ typedef struct gistxlogPage int num; /* number of index tuples following */ } gistxlogPage; -typedef struct gistxlogPageDelete -{ - RelFileNode node; - BlockNumber blkno; -} gistxlogPageDelete; - /* SplitedPageLayout - gistSplit function result */ typedef struct SplitedPageLayout { @@ -254,20 +263,21 @@ typedef struct GISTInsertStack struct GISTInsertStack *parent; } GISTInsertStack; +/* Working state and results for multi-column split logic in gistsplit.c */ typedef struct GistSplitVector { - GIST_SPLITVEC splitVector; /* to/from PickSplit method */ + GIST_SPLITVEC splitVector; /* passed to/from user PickSplit method */ Datum spl_lattr[INDEX_MAX_KEYS]; /* Union of subkeys in - * spl_left */ + * splitVector.spl_left */ bool spl_lisnull[INDEX_MAX_KEYS]; Datum spl_rattr[INDEX_MAX_KEYS]; /* Union of subkeys in - * spl_right */ + * splitVector.spl_right */ bool spl_risnull[INDEX_MAX_KEYS]; - bool *spl_equiv; /* equivalent tuples which can be freely - * distributed between left and right pages */ + bool *spl_dontcare; /* flags tuples which could go to either side + * of the split for zero penalty */ } GistSplitVector; typedef struct @@ -430,7 +440,8 @@ typedef struct extern bool gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate, Buffer buffer, - IndexTuple *itup, int ntup, OffsetNumber oldoffnum, + IndexTuple *itup, int ntup, + OffsetNumber oldoffnum, BlockNumber *newblkno, Buffer leftchildbuf, List **splitinfo, bool markleftchild); @@ -505,7 +516,7 @@ extern void gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e, extern float gistpenalty(GISTSTATE *giststate, int attno, GISTENTRY *key1, bool isNull1, GISTENTRY *key2, bool isNull2); -extern void gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len, int startkey, +extern void gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len, Datum *attr, bool *isnull); extern bool gistKeyIsEQ(GISTSTATE *giststate, int attno, Datum a, Datum b); extern void gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p, @@ -516,7 +527,7 @@ extern void gistMakeUnionKey(GISTSTATE *giststate, int attno, GISTENTRY *entry2, bool isnull2, Datum *dst, bool *dstisnull); -extern XLogRecPtr GetXLogRecPtrForTemp(void); +extern XLogRecPtr gistGetFakeLSN(Relation rel); /* gistvacuum.c */ extern Datum gistbulkdelete(PG_FUNCTION_ARGS); @@ -525,7 +536,7 @@ extern Datum gistvacuumcleanup(PG_FUNCTION_ARGS); /* gistsplit.c */ extern void gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len, GISTSTATE *giststate, - GistSplitVector *v, GistEntryVector *entryvec, + GistSplitVector *v, int attno); /* gistbuild.c */ diff --git a/src/include/access/gistscan.h b/src/include/access/gistscan.h index 4950370f04..92515f88c7 100644 --- a/src/include/access/gistscan.h +++ b/src/include/access/gistscan.h @@ -4,7 +4,7 @@ * routines defined in access/gist/gistscan.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/gistscan.h diff --git a/src/include/access/hash.h b/src/include/access/hash.h index 726970b762..318add9c4c 100644 --- a/src/include/access/hash.h +++ b/src/include/access/hash.h @@ -4,7 +4,7 @@ * header file for postgres hash access method implementation * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/hash.h @@ -185,7 +185,7 @@ typedef HashMetaPageData *HashMetaPage; #define ALL_SET ((uint32) ~0) /* - * Bitmap pages do not contain tuples. They do contain the standard + * Bitmap pages do not contain tuples. They do contain the standard * page headers and trailers; however, everything in between is a * giant bit array. The number of bits that fit on a page obviously * depends on the page size and the header/trailer overhead. We require @@ -334,7 +334,7 @@ extern bool _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir); /* hashsort.c */ typedef struct HSpool HSpool; /* opaque struct in hashsort.c */ -extern HSpool *_h_spoolinit(Relation index, uint32 num_buckets); +extern HSpool *_h_spoolinit(Relation heap, Relation index, uint32 num_buckets); extern void _h_spooldestroy(HSpool *hspool); extern void _h_spool(IndexTuple itup, HSpool *hspool); extern void _h_indexbuild(HSpool *hspool); diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 026a19fa74..493839f60e 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -4,7 +4,7 @@ * POSTGRES heap access method definitions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/heapam.h @@ -16,8 +16,8 @@ #include "access/sdir.h" #include "access/skey.h" -#include "access/xlog.h" #include "nodes/primnodes.h" +#include "storage/bufpage.h" #include "storage/lock.h" #include "utils/relcache.h" #include "utils/snapshot.h" @@ -26,15 +26,50 @@ /* "options" flag bits for heap_insert */ #define HEAP_INSERT_SKIP_WAL 0x0001 #define HEAP_INSERT_SKIP_FSM 0x0002 +#define HEAP_INSERT_FROZEN 0x0004 typedef struct BulkInsertStateData *BulkInsertState; -typedef enum +/* + * Possible lock modes for a tuple. + */ +typedef enum LockTupleMode { - LockTupleShared, + /* SELECT FOR KEY SHARE */ + LockTupleKeyShare, + /* SELECT FOR SHARE */ + LockTupleShare, + /* SELECT FOR NO KEY UPDATE, and UPDATEs that don't modify key columns */ + LockTupleNoKeyExclusive, + /* SELECT FOR UPDATE, UPDATEs that modify key columns, and DELETE */ LockTupleExclusive } LockTupleMode; +#define MaxLockTupleMode LockTupleExclusive + +/* + * When heap_update, heap_delete, or heap_lock_tuple fail because the target + * tuple is already outdated, they fill in this struct to provide information + * to the caller about what happened. + * ctid is the target's ctid link: it is the same as the target's TID if the + * target was deleted, or the location of the replacement tuple if the target + * was updated. + * xmax is the outdating transaction's XID. If the caller wants to visit the + * replacement tuple, it must check that this matches before believing the + * replacement is really a match. + * cmax is the outdating command's CID, but only when the failure code is + * HeapTupleSelfUpdated (i.e., something in the current transaction outdated + * the tuple); otherwise cmax is zero. (We make this restriction because + * HeapTupleHeaderGetCmax doesn't work for tuples outdated in other + * transactions.) + */ +typedef struct HeapUpdateFailureData +{ + ItemPointerData ctid; + TransactionId xmax; + CommandId cmax; +} HeapUpdateFailureData; + /* ---------------- * function prototypes for heap access method @@ -70,6 +105,8 @@ typedef struct HeapScanDescData *HeapScanDesc; extern HeapScanDesc heap_beginscan(Relation relation, Snapshot snapshot, int nkeys, ScanKey key); +extern HeapScanDesc heap_beginscan_catalog(Relation relation, int nkeys, + ScanKey key); extern HeapScanDesc heap_beginscan_strat(Relation relation, Snapshot snapshot, int nkeys, ScanKey key, bool allow_strat, bool allow_sync); @@ -100,20 +137,21 @@ extern Oid heap_insert(Relation relation, HeapTuple tup, CommandId cid, extern void heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples, CommandId cid, int options, BulkInsertState bistate); extern HTSU_Result heap_delete(Relation relation, ItemPointer tid, - ItemPointer ctid, TransactionId *update_xmax, - CommandId cid, Snapshot crosscheck, bool wait); + CommandId cid, Snapshot crosscheck, bool wait, + HeapUpdateFailureData *hufd); extern HTSU_Result heap_update(Relation relation, ItemPointer otid, HeapTuple newtup, - ItemPointer ctid, TransactionId *update_xmax, - CommandId cid, Snapshot crosscheck, bool wait); + CommandId cid, Snapshot crosscheck, bool wait, + HeapUpdateFailureData *hufd, LockTupleMode *lockmode); extern HTSU_Result heap_lock_tuple(Relation relation, HeapTuple tuple, - Buffer *buffer, ItemPointer ctid, - TransactionId *update_xmax, CommandId cid, - LockTupleMode mode, bool nowait); + CommandId cid, LockTupleMode mode, bool nowait, + bool follow_update, + Buffer *buffer, HeapUpdateFailureData *hufd); extern void heap_inplace_update(Relation relation, HeapTuple tuple); -extern bool heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid); +extern bool heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid, + TransactionId cutoff_multi); extern bool heap_tuple_needs_freeze(HeapTupleHeader tuple, TransactionId cutoff_xid, - Buffer buf); + MultiXactId cutoff_multi, Buffer buf); extern Oid simple_heap_insert(Relation relation, HeapTuple tup); extern void simple_heap_delete(Relation relation, ItemPointer tid); @@ -125,29 +163,8 @@ extern void heap_restrpos(HeapScanDesc scan); extern void heap_sync(Relation relation); -extern void heap_redo(XLogRecPtr lsn, XLogRecord *rptr); -extern void heap_desc(StringInfo buf, uint8 xl_info, char *rec); -extern void heap2_redo(XLogRecPtr lsn, XLogRecord *rptr); -extern void heap2_desc(StringInfo buf, uint8 xl_info, char *rec); - -extern XLogRecPtr log_heap_cleanup_info(RelFileNode rnode, - TransactionId latestRemovedXid); -extern XLogRecPtr log_heap_clean(Relation reln, Buffer buffer, - OffsetNumber *redirected, int nredirected, - OffsetNumber *nowdead, int ndead, - OffsetNumber *nowunused, int nunused, - TransactionId latestRemovedXid); -extern XLogRecPtr log_heap_freeze(Relation reln, Buffer buffer, - TransactionId cutoff_xid, - OffsetNumber *offsets, int offcnt); -extern XLogRecPtr log_heap_visible(RelFileNode rnode, BlockNumber block, - Buffer vm_buffer, TransactionId cutoff_xid); -extern XLogRecPtr log_newpage(RelFileNode *rnode, ForkNumber forkNum, - BlockNumber blk, Page page); - /* in heap/pruneheap.c */ -extern void heap_page_prune_opt(Relation relation, Buffer buffer, - TransactionId OldestXmin); +extern void heap_page_prune_opt(Relation relation, Buffer buffer); extern int heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin, bool report_stats, TransactionId *latestRemovedXid); diff --git a/src/include/access/heapam_xlog.h b/src/include/access/heapam_xlog.h new file mode 100644 index 0000000000..cfdd1ffbef --- /dev/null +++ b/src/include/access/heapam_xlog.h @@ -0,0 +1,398 @@ +/*------------------------------------------------------------------------- + * + * heapam_xlog.h + * POSTGRES heap access XLOG definitions. + * + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/heapam_xlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef HEAPAM_XLOG_H +#define HEAPAM_XLOG_H + +#include "access/htup.h" +#include "access/xlog.h" +#include "storage/bufpage.h" +#include "storage/relfilenode.h" +#include "utils/relcache.h" + + +/* + * WAL record definitions for heapam.c's WAL operations + * + * XLOG allows to store some information in high 4 bits of log + * record xl_info field. We use 3 for opcode and one for init bit. + */ +#define XLOG_HEAP_INSERT 0x00 +#define XLOG_HEAP_DELETE 0x10 +#define XLOG_HEAP_UPDATE 0x20 +/* 0x030 is free, was XLOG_HEAP_MOVE */ +#define XLOG_HEAP_HOT_UPDATE 0x40 +#define XLOG_HEAP_NEWPAGE 0x50 +#define XLOG_HEAP_LOCK 0x60 +#define XLOG_HEAP_INPLACE 0x70 + +#define XLOG_HEAP_OPMASK 0x70 +/* + * When we insert 1st item on new page in INSERT, UPDATE, HOT_UPDATE, + * or MULTI_INSERT, we can (and we do) restore entire page in redo + */ +#define XLOG_HEAP_INIT_PAGE 0x80 +/* + * We ran out of opcodes, so heapam.c now has a second RmgrId. These opcodes + * are associated with RM_HEAP2_ID, but are not logically different from + * the ones above associated with RM_HEAP_ID. XLOG_HEAP_OPMASK applies to + * these, too. + */ +#define XLOG_HEAP2_REWRITE 0x00 +#define XLOG_HEAP2_CLEAN 0x10 +#define XLOG_HEAP2_FREEZE_PAGE 0x20 +#define XLOG_HEAP2_CLEANUP_INFO 0x30 +#define XLOG_HEAP2_VISIBLE 0x40 +#define XLOG_HEAP2_MULTI_INSERT 0x50 +#define XLOG_HEAP2_LOCK_UPDATED 0x60 +#define XLOG_HEAP2_NEW_CID 0x70 + +/* + * xl_heap_* ->flag values, 8 bits are available. + */ +/* PD_ALL_VISIBLE was cleared */ +#define XLOG_HEAP_ALL_VISIBLE_CLEARED (1<<0) +/* PD_ALL_VISIBLE was cleared in the 2nd page */ +#define XLOG_HEAP_NEW_ALL_VISIBLE_CLEARED (1<<1) +#define XLOG_HEAP_CONTAINS_OLD_TUPLE (1<<2) +#define XLOG_HEAP_CONTAINS_OLD_KEY (1<<3) +#define XLOG_HEAP_CONTAINS_NEW_TUPLE (1<<4) +#define XLOG_HEAP_PREFIX_FROM_OLD (1<<5) +#define XLOG_HEAP_SUFFIX_FROM_OLD (1<<6) + +/* convenience macro for checking whether any form of old tuple was logged */ +#define XLOG_HEAP_CONTAINS_OLD \ + (XLOG_HEAP_CONTAINS_OLD_TUPLE | XLOG_HEAP_CONTAINS_OLD_KEY) + +/* + * All what we need to find changed tuple + * + * NB: on most machines, sizeof(xl_heaptid) will include some trailing pad + * bytes for alignment. We don't want to store the pad space in the XLOG, + * so use SizeOfHeapTid for space calculations. Similar comments apply for + * the other xl_FOO structs. + */ +typedef struct xl_heaptid +{ + RelFileNode node; + ItemPointerData tid; /* changed tuple id */ +} xl_heaptid; + +#define SizeOfHeapTid (offsetof(xl_heaptid, tid) + SizeOfIptrData) + +/* This is what we need to know about delete */ +typedef struct xl_heap_delete +{ + xl_heaptid target; /* deleted tuple id */ + TransactionId xmax; /* xmax of the deleted tuple */ + uint8 infobits_set; /* infomask bits */ + uint8 flags; +} xl_heap_delete; + +#define SizeOfHeapDelete (offsetof(xl_heap_delete, flags) + sizeof(uint8)) + +/* + * We don't store the whole fixed part (HeapTupleHeaderData) of an inserted + * or updated tuple in WAL; we can save a few bytes by reconstructing the + * fields that are available elsewhere in the WAL record, or perhaps just + * plain needn't be reconstructed. These are the fields we must store. + * NOTE: t_hoff could be recomputed, but we may as well store it because + * it will come for free due to alignment considerations. + */ +typedef struct xl_heap_header +{ + uint16 t_infomask2; + uint16 t_infomask; + uint8 t_hoff; +} xl_heap_header; + +#define SizeOfHeapHeader (offsetof(xl_heap_header, t_hoff) + sizeof(uint8)) + +/* + * Variant of xl_heap_header that contains the length of the tuple, which is + * useful if the length of the tuple cannot be computed using the overall + * record length. E.g. because there are several tuples inside a single + * record. + */ +typedef struct xl_heap_header_len +{ + uint16 t_len; + xl_heap_header header; +} xl_heap_header_len; + +#define SizeOfHeapHeaderLen (offsetof(xl_heap_header_len, header) + SizeOfHeapHeader) + +/* This is what we need to know about insert */ +typedef struct xl_heap_insert +{ + xl_heaptid target; /* inserted tuple id */ + uint8 flags; + /* xl_heap_header & TUPLE DATA FOLLOWS AT END OF STRUCT */ +} xl_heap_insert; + +#define SizeOfHeapInsert (offsetof(xl_heap_insert, flags) + sizeof(uint8)) + +/* + * This is what we need to know about a multi-insert. The record consists of + * xl_heap_multi_insert header, followed by a xl_multi_insert_tuple and tuple + * data for each tuple. 'offsets' array is omitted if the whole page is + * reinitialized (XLOG_HEAP_INIT_PAGE) + */ +typedef struct xl_heap_multi_insert +{ + RelFileNode node; + BlockNumber blkno; + uint8 flags; + uint16 ntuples; + OffsetNumber offsets[1]; + + /* TUPLE DATA (xl_multi_insert_tuples) FOLLOW AT END OF STRUCT */ +} xl_heap_multi_insert; + +#define SizeOfHeapMultiInsert offsetof(xl_heap_multi_insert, offsets) + +typedef struct xl_multi_insert_tuple +{ + uint16 datalen; /* size of tuple data that follows */ + uint16 t_infomask2; + uint16 t_infomask; + uint8 t_hoff; + /* TUPLE DATA FOLLOWS AT END OF STRUCT */ +} xl_multi_insert_tuple; + +#define SizeOfMultiInsertTuple (offsetof(xl_multi_insert_tuple, t_hoff) + sizeof(uint8)) + +/* This is what we need to know about update|hot_update */ +typedef struct xl_heap_update +{ + xl_heaptid target; /* deleted tuple id */ + TransactionId old_xmax; /* xmax of the old tuple */ + TransactionId new_xmax; /* xmax of the new tuple */ + ItemPointerData newtid; /* new inserted tuple id */ + uint8 old_infobits_set; /* infomask bits to set on old tuple */ + uint8 flags; + + /* + * If XLOG_HEAP_PREFIX_FROM_OLD or XLOG_HEAP_SUFFIX_FROM_OLD flags are + * set, the prefix and/or suffix come next, as one or two uint16s. + * + * After that, xl_heap_header_len and new tuple data follow. The new + * tuple data and length don't include the prefix and suffix, which are + * copied from the old tuple on replay. The new tuple data is omitted if + * a full-page image of the page was taken (unless the + * XLOG_HEAP_CONTAINS_NEW_TUPLE flag is set, in which case it's included + * anyway). + * + * If XLOG_HEAP_CONTAINS_OLD_TUPLE or XLOG_HEAP_CONTAINS_OLD_KEY flags are + * set, another xl_heap_header_len struct and tuple data for the old tuple + * follows. + */ +} xl_heap_update; + +#define SizeOfHeapUpdate (offsetof(xl_heap_update, flags) + sizeof(uint8)) + +/* + * This is what we need to know about vacuum page cleanup/redirect + * + * The array of OffsetNumbers following the fixed part of the record contains: + * * for each redirected item: the item offset, then the offset redirected to + * * for each now-dead item: the item offset + * * for each now-unused item: the item offset + * The total number of OffsetNumbers is therefore 2*nredirected+ndead+nunused. + * Note that nunused is not explicitly stored, but may be found by reference + * to the total record length. + */ +typedef struct xl_heap_clean +{ + RelFileNode node; + BlockNumber block; + TransactionId latestRemovedXid; + uint16 nredirected; + uint16 ndead; + /* OFFSET NUMBERS FOLLOW */ +} xl_heap_clean; + +#define SizeOfHeapClean (offsetof(xl_heap_clean, ndead) + sizeof(uint16)) + +/* + * Cleanup_info is required in some cases during a lazy VACUUM. + * Used for reporting the results of HeapTupleHeaderAdvanceLatestRemovedXid() + * see vacuumlazy.c for full explanation + */ +typedef struct xl_heap_cleanup_info +{ + RelFileNode node; + TransactionId latestRemovedXid; +} xl_heap_cleanup_info; + +#define SizeOfHeapCleanupInfo (sizeof(xl_heap_cleanup_info)) + +/* This is for replacing a page's contents in toto */ +/* NB: this is used for indexes as well as heaps */ +typedef struct xl_heap_newpage +{ + RelFileNode node; + ForkNumber forknum; + BlockNumber blkno; /* location of new page */ + uint16 hole_offset; /* number of bytes before "hole" */ + uint16 hole_length; /* number of bytes in "hole" */ + /* entire page contents (minus the hole) follow at end of record */ +} xl_heap_newpage; + +#define SizeOfHeapNewpage (offsetof(xl_heap_newpage, hole_length) + sizeof(uint16)) + +/* flags for infobits_set */ +#define XLHL_XMAX_IS_MULTI 0x01 +#define XLHL_XMAX_LOCK_ONLY 0x02 +#define XLHL_XMAX_EXCL_LOCK 0x04 +#define XLHL_XMAX_KEYSHR_LOCK 0x08 +#define XLHL_KEYS_UPDATED 0x10 + +/* This is what we need to know about lock */ +typedef struct xl_heap_lock +{ + xl_heaptid target; /* locked tuple id */ + TransactionId locking_xid; /* might be a MultiXactId not xid */ + int8 infobits_set; /* infomask and infomask2 bits to set */ +} xl_heap_lock; + +#define SizeOfHeapLock (offsetof(xl_heap_lock, infobits_set) + sizeof(int8)) + +/* This is what we need to know about locking an updated version of a row */ +typedef struct xl_heap_lock_updated +{ + xl_heaptid target; + TransactionId xmax; + uint8 infobits_set; +} xl_heap_lock_updated; + +#define SizeOfHeapLockUpdated (offsetof(xl_heap_lock_updated, infobits_set) + sizeof(uint8)) + +/* This is what we need to know about in-place update */ +typedef struct xl_heap_inplace +{ + xl_heaptid target; /* updated tuple id */ + /* TUPLE DATA FOLLOWS AT END OF STRUCT */ +} xl_heap_inplace; + +#define SizeOfHeapInplace (offsetof(xl_heap_inplace, target) + SizeOfHeapTid) + +/* + * This struct represents a 'freeze plan', which is what we need to know about + * a single tuple being frozen during vacuum. + */ +/* 0x01 was XLH_FREEZE_XMIN */ +#define XLH_FREEZE_XVAC 0x02 +#define XLH_INVALID_XVAC 0x04 + +typedef struct xl_heap_freeze_tuple +{ + TransactionId xmax; + OffsetNumber offset; + uint16 t_infomask2; + uint16 t_infomask; + uint8 frzflags; +} xl_heap_freeze_tuple; + +/* + * This is what we need to know about a block being frozen during vacuum + */ +typedef struct xl_heap_freeze_page +{ + RelFileNode node; + BlockNumber block; + TransactionId cutoff_xid; + uint16 ntuples; + xl_heap_freeze_tuple tuples[FLEXIBLE_ARRAY_MEMBER]; +} xl_heap_freeze_page; + +#define SizeOfHeapFreezePage offsetof(xl_heap_freeze_page, tuples) + +/* This is what we need to know about setting a visibility map bit */ +typedef struct xl_heap_visible +{ + RelFileNode node; + BlockNumber block; + TransactionId cutoff_xid; +} xl_heap_visible; + +#define SizeOfHeapVisible (offsetof(xl_heap_visible, cutoff_xid) + sizeof(TransactionId)) + +typedef struct xl_heap_new_cid +{ + /* + * store toplevel xid so we don't have to merge cids from different + * transactions + */ + TransactionId top_xid; + CommandId cmin; + CommandId cmax; + + /* + * don't really need the combocid since we have the actual values right in + * this struct, but the padding makes it free and its useful for + * debugging. + */ + CommandId combocid; + + /* + * Store the relfilenode/ctid pair to facilitate lookups. + */ + xl_heaptid target; +} xl_heap_new_cid; + +#define SizeOfHeapNewCid (offsetof(xl_heap_new_cid, target) + SizeOfHeapTid) + +/* logical rewrite xlog record header */ +typedef struct xl_heap_rewrite_mapping +{ + TransactionId mapped_xid; /* xid that might need to see the row */ + Oid mapped_db; /* DbOid or InvalidOid for shared rels */ + Oid mapped_rel; /* Oid of the mapped relation */ + off_t offset; /* How far have we written so far */ + uint32 num_mappings; /* Number of in-memory mappings */ + XLogRecPtr start_lsn; /* Insert LSN at begin of rewrite */ +} xl_heap_rewrite_mapping; + +extern void HeapTupleHeaderAdvanceLatestRemovedXid(HeapTupleHeader tuple, + TransactionId *latestRemovedXid); + +extern void heap_redo(XLogRecPtr lsn, XLogRecord *rptr); +extern void heap_desc(StringInfo buf, uint8 xl_info, char *rec); +extern void heap2_redo(XLogRecPtr lsn, XLogRecord *rptr); +extern void heap2_desc(StringInfo buf, uint8 xl_info, char *rec); +extern void heap_xlog_logical_rewrite(XLogRecPtr lsn, XLogRecord *r); + +extern XLogRecPtr log_heap_cleanup_info(RelFileNode rnode, + TransactionId latestRemovedXid); +extern XLogRecPtr log_heap_clean(Relation reln, Buffer buffer, + OffsetNumber *redirected, int nredirected, + OffsetNumber *nowdead, int ndead, + OffsetNumber *nowunused, int nunused, + TransactionId latestRemovedXid); +extern XLogRecPtr log_heap_freeze(Relation reln, Buffer buffer, + TransactionId cutoff_xid, xl_heap_freeze_tuple *tuples, + int ntuples); +extern bool heap_prepare_freeze_tuple(HeapTupleHeader tuple, + TransactionId cutoff_xid, + TransactionId cutoff_multi, + xl_heap_freeze_tuple *frz); +extern void heap_execute_freeze_tuple(HeapTupleHeader tuple, + xl_heap_freeze_tuple *xlrec_tp); +extern XLogRecPtr log_heap_visible(RelFileNode rnode, Buffer heap_buffer, + Buffer vm_buffer, TransactionId cutoff_xid); +extern XLogRecPtr log_newpage(RelFileNode *rnode, ForkNumber forkNum, + BlockNumber blk, Page page, bool page_std); +extern XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std); + +#endif /* HEAPAM_XLOG_H */ diff --git a/src/include/access/hio.h b/src/include/access/hio.h index a3f8a457b8..422fe3403a 100644 --- a/src/include/access/hio.h +++ b/src/include/access/hio.h @@ -4,7 +4,7 @@ * POSTGRES heap access method input/output definitions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/hio.h diff --git a/src/include/access/htup.h b/src/include/access/htup.h index fbb802e4c9..be3ef236e1 100644 --- a/src/include/access/htup.h +++ b/src/include/access/htup.h @@ -9,7 +9,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/htup.h @@ -19,470 +19,15 @@ #ifndef HTUP_H #define HTUP_H -#include "access/tupdesc.h" -#include "access/tupmacs.h" -#include "storage/bufpage.h" #include "storage/itemptr.h" -#include "storage/relfilenode.h" -/* - * MaxTupleAttributeNumber limits the number of (user) columns in a tuple. - * The key limit on this value is that the size of the fixed overhead for - * a tuple, plus the size of the null-values bitmap (at 1 bit per column), - * plus MAXALIGN alignment, must fit into t_hoff which is uint8. On most - * machines the upper limit without making t_hoff wider would be a little - * over 1700. We use round numbers here and for MaxHeapAttributeNumber - * so that alterations in HeapTupleHeaderData layout won't change the - * supported max number of columns. - */ -#define MaxTupleAttributeNumber 1664 /* 8 * 208 */ - -/* - * MaxHeapAttributeNumber limits the number of (user) columns in a table. - * This should be somewhat less than MaxTupleAttributeNumber. It must be - * at least one less, else we will fail to do UPDATEs on a maximal-width - * table (because UPDATE has to form working tuples that include CTID). - * In practice we want some additional daylight so that we can gracefully - * support operations that add hidden "resjunk" columns, for example - * SELECT * FROM wide_table ORDER BY foo, bar, baz. - * In any case, depending on column data types you will likely be running - * into the disk-block-based limit on overall tuple size if you have more - * than a thousand or so columns. TOAST won't help. - */ -#define MaxHeapAttributeNumber 1600 /* 8 * 200 */ - -/* - * Heap tuple header. To avoid wasting space, the fields should be - * laid out in such a way as to avoid structure padding. - * - * Datums of composite types (row types) share the same general structure - * as on-disk tuples, so that the same routines can be used to build and - * examine them. However the requirements are slightly different: a Datum - * does not need any transaction visibility information, and it does need - * a length word and some embedded type information. We can achieve this - * by overlaying the xmin/cmin/xmax/cmax/xvac fields of a heap tuple - * with the fields needed in the Datum case. Typically, all tuples built - * in-memory will be initialized with the Datum fields; but when a tuple is - * about to be inserted in a table, the transaction fields will be filled, - * overwriting the datum fields. - * - * The overall structure of a heap tuple looks like: - * fixed fields (HeapTupleHeaderData struct) - * nulls bitmap (if HEAP_HASNULL is set in t_infomask) - * alignment padding (as needed to make user data MAXALIGN'd) - * object ID (if HEAP_HASOID is set in t_infomask) - * user data fields - * - * We store five "virtual" fields Xmin, Cmin, Xmax, Cmax, and Xvac in three - * physical fields. Xmin and Xmax are always really stored, but Cmin, Cmax - * and Xvac share a field. This works because we know that Cmin and Cmax - * are only interesting for the lifetime of the inserting and deleting - * transaction respectively. If a tuple is inserted and deleted in the same - * transaction, we store a "combo" command id that can be mapped to the real - * cmin and cmax, but only by use of local state within the originating - * backend. See combocid.c for more details. Meanwhile, Xvac is only set by - * old-style VACUUM FULL, which does not have any command sub-structure and so - * does not need either Cmin or Cmax. (This requires that old-style VACUUM - * FULL never try to move a tuple whose Cmin or Cmax is still interesting, - * ie, an insert-in-progress or delete-in-progress tuple.) - * - * A word about t_ctid: whenever a new tuple is stored on disk, its t_ctid - * is initialized with its own TID (location). If the tuple is ever updated, - * its t_ctid is changed to point to the replacement version of the tuple. - * Thus, a tuple is the latest version of its row iff XMAX is invalid or - * t_ctid points to itself (in which case, if XMAX is valid, the tuple is - * either locked or deleted). One can follow the chain of t_ctid links - * to find the newest version of the row. Beware however that VACUUM might - * erase the pointed-to (newer) tuple before erasing the pointing (older) - * tuple. Hence, when following a t_ctid link, it is necessary to check - * to see if the referenced slot is empty or contains an unrelated tuple. - * Check that the referenced tuple has XMIN equal to the referencing tuple's - * XMAX to verify that it is actually the descendant version and not an - * unrelated tuple stored into a slot recently freed by VACUUM. If either - * check fails, one may assume that there is no live descendant version. - * - * Following the fixed header fields, the nulls bitmap is stored (beginning - * at t_bits). The bitmap is *not* stored if t_infomask shows that there - * are no nulls in the tuple. If an OID field is present (as indicated by - * t_infomask), then it is stored just before the user data, which begins at - * the offset shown by t_hoff. Note that t_hoff must be a multiple of - * MAXALIGN. - */ - -typedef struct HeapTupleFields -{ - TransactionId t_xmin; /* inserting xact ID */ - TransactionId t_xmax; /* deleting or locking xact ID */ - - union - { - CommandId t_cid; /* inserting or deleting command ID, or both */ - TransactionId t_xvac; /* old-style VACUUM FULL xact ID */ - } t_field3; -} HeapTupleFields; - -typedef struct DatumTupleFields -{ - int32 datum_len_; /* varlena header (do not touch directly!) */ - - int32 datum_typmod; /* -1, or identifier of a record type */ - - Oid datum_typeid; /* composite type OID, or RECORDOID */ - - /* - * Note: field ordering is chosen with thought that Oid might someday - * widen to 64 bits. - */ -} DatumTupleFields; - -typedef struct HeapTupleHeaderData -{ - union - { - HeapTupleFields t_heap; - DatumTupleFields t_datum; - } t_choice; - - ItemPointerData t_ctid; /* current TID of this or newer tuple */ - - /* Fields below here must match MinimalTupleData! */ - - uint16 t_infomask2; /* number of attributes + various flags */ +/* typedefs and forward declarations for structs defined in htup_details.h */ - uint16 t_infomask; /* various flag bits, see below */ - - uint8 t_hoff; /* sizeof header incl. bitmap, padding */ - - /* ^ - 23 bytes - ^ */ - - bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */ - - /* MORE DATA FOLLOWS AT END OF STRUCT */ -} HeapTupleHeaderData; +typedef struct HeapTupleHeaderData HeapTupleHeaderData; typedef HeapTupleHeaderData *HeapTupleHeader; -/* - * information stored in t_infomask: - */ -#define HEAP_HASNULL 0x0001 /* has null attribute(s) */ -#define HEAP_HASVARWIDTH 0x0002 /* has variable-width attribute(s) */ -#define HEAP_HASEXTERNAL 0x0004 /* has external stored attribute(s) */ -#define HEAP_HASOID 0x0008 /* has an object-id field */ -/* bit 0x0010 is available */ -#define HEAP_COMBOCID 0x0020 /* t_cid is a combo cid */ -#define HEAP_XMAX_EXCL_LOCK 0x0040 /* xmax is exclusive locker */ -#define HEAP_XMAX_SHARED_LOCK 0x0080 /* xmax is shared locker */ -/* if either LOCK bit is set, xmax hasn't deleted the tuple, only locked it */ -#define HEAP_IS_LOCKED (HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_SHARED_LOCK) -#define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */ -#define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */ -#define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */ -#define HEAP_XMAX_INVALID 0x0800 /* t_xmax invalid/aborted */ -#define HEAP_XMAX_IS_MULTI 0x1000 /* t_xmax is a MultiXactId */ -#define HEAP_UPDATED 0x2000 /* this is UPDATEd version of row */ -#define HEAP_MOVED_OFF 0x4000 /* moved to another place by pre-9.0 - * VACUUM FULL; kept for binary - * upgrade support */ -#define HEAP_MOVED_IN 0x8000 /* moved from another place by pre-9.0 - * VACUUM FULL; kept for binary - * upgrade support */ -#define HEAP_MOVED (HEAP_MOVED_OFF | HEAP_MOVED_IN) - -#define HEAP_XACT_MASK 0xFFE0 /* visibility-related bits */ - -/* - * information stored in t_infomask2: - */ -#define HEAP_NATTS_MASK 0x07FF /* 11 bits for number of attributes */ -/* bits 0x3800 are available */ -#define HEAP_HOT_UPDATED 0x4000 /* tuple was HOT-updated */ -#define HEAP_ONLY_TUPLE 0x8000 /* this is heap-only tuple */ - -#define HEAP2_XACT_MASK 0xC000 /* visibility-related bits */ - -/* - * HEAP_TUPLE_HAS_MATCH is a temporary flag used during hash joins. It is - * only used in tuples that are in the hash table, and those don't need - * any visibility information, so we can overlay it on a visibility flag - * instead of using up a dedicated bit. - */ -#define HEAP_TUPLE_HAS_MATCH HEAP_ONLY_TUPLE /* tuple has a join match */ - -/* - * HeapTupleHeader accessor macros - * - * Note: beware of multiple evaluations of "tup" argument. But the Set - * macros evaluate their other argument only once. - */ - -#define HeapTupleHeaderGetXmin(tup) \ -( \ - (tup)->t_choice.t_heap.t_xmin \ -) - -#define HeapTupleHeaderSetXmin(tup, xid) \ -( \ - (tup)->t_choice.t_heap.t_xmin = (xid) \ -) - -#define HeapTupleHeaderGetXmax(tup) \ -( \ - (tup)->t_choice.t_heap.t_xmax \ -) - -#define HeapTupleHeaderSetXmax(tup, xid) \ -( \ - (tup)->t_choice.t_heap.t_xmax = (xid) \ -) - -/* - * HeapTupleHeaderGetRawCommandId will give you what's in the header whether - * it is useful or not. Most code should use HeapTupleHeaderGetCmin or - * HeapTupleHeaderGetCmax instead, but note that those Assert that you can - * get a legitimate result, ie you are in the originating transaction! - */ -#define HeapTupleHeaderGetRawCommandId(tup) \ -( \ - (tup)->t_choice.t_heap.t_field3.t_cid \ -) - -/* SetCmin is reasonably simple since we never need a combo CID */ -#define HeapTupleHeaderSetCmin(tup, cid) \ -do { \ - Assert(!((tup)->t_infomask & HEAP_MOVED)); \ - (tup)->t_choice.t_heap.t_field3.t_cid = (cid); \ - (tup)->t_infomask &= ~HEAP_COMBOCID; \ -} while (0) - -/* SetCmax must be used after HeapTupleHeaderAdjustCmax; see combocid.c */ -#define HeapTupleHeaderSetCmax(tup, cid, iscombo) \ -do { \ - Assert(!((tup)->t_infomask & HEAP_MOVED)); \ - (tup)->t_choice.t_heap.t_field3.t_cid = (cid); \ - if (iscombo) \ - (tup)->t_infomask |= HEAP_COMBOCID; \ - else \ - (tup)->t_infomask &= ~HEAP_COMBOCID; \ -} while (0) - -#define HeapTupleHeaderGetXvac(tup) \ -( \ - ((tup)->t_infomask & HEAP_MOVED) ? \ - (tup)->t_choice.t_heap.t_field3.t_xvac \ - : \ - InvalidTransactionId \ -) - -#define HeapTupleHeaderSetXvac(tup, xid) \ -do { \ - Assert((tup)->t_infomask & HEAP_MOVED); \ - (tup)->t_choice.t_heap.t_field3.t_xvac = (xid); \ -} while (0) - -#define HeapTupleHeaderGetDatumLength(tup) \ - VARSIZE(tup) - -#define HeapTupleHeaderSetDatumLength(tup, len) \ - SET_VARSIZE(tup, len) - -#define HeapTupleHeaderGetTypeId(tup) \ -( \ - (tup)->t_choice.t_datum.datum_typeid \ -) - -#define HeapTupleHeaderSetTypeId(tup, typeid) \ -( \ - (tup)->t_choice.t_datum.datum_typeid = (typeid) \ -) - -#define HeapTupleHeaderGetTypMod(tup) \ -( \ - (tup)->t_choice.t_datum.datum_typmod \ -) - -#define HeapTupleHeaderSetTypMod(tup, typmod) \ -( \ - (tup)->t_choice.t_datum.datum_typmod = (typmod) \ -) - -#define HeapTupleHeaderGetOid(tup) \ -( \ - ((tup)->t_infomask & HEAP_HASOID) ? \ - *((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) \ - : \ - InvalidOid \ -) - -#define HeapTupleHeaderSetOid(tup, oid) \ -do { \ - Assert((tup)->t_infomask & HEAP_HASOID); \ - *((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) = (oid); \ -} while (0) - -/* - * Note that we stop considering a tuple HOT-updated as soon as it is known - * aborted or the would-be updating transaction is known aborted. For best - * efficiency, check tuple visibility before using this macro, so that the - * INVALID bits will be as up to date as possible. - */ -#define HeapTupleHeaderIsHotUpdated(tup) \ -( \ - ((tup)->t_infomask2 & HEAP_HOT_UPDATED) != 0 && \ - ((tup)->t_infomask & (HEAP_XMIN_INVALID | HEAP_XMAX_INVALID)) == 0 \ -) - -#define HeapTupleHeaderSetHotUpdated(tup) \ -( \ - (tup)->t_infomask2 |= HEAP_HOT_UPDATED \ -) - -#define HeapTupleHeaderClearHotUpdated(tup) \ -( \ - (tup)->t_infomask2 &= ~HEAP_HOT_UPDATED \ -) - -#define HeapTupleHeaderIsHeapOnly(tup) \ -( \ - (tup)->t_infomask2 & HEAP_ONLY_TUPLE \ -) - -#define HeapTupleHeaderSetHeapOnly(tup) \ -( \ - (tup)->t_infomask2 |= HEAP_ONLY_TUPLE \ -) - -#define HeapTupleHeaderClearHeapOnly(tup) \ -( \ - (tup)->t_infomask2 &= ~HEAP_ONLY_TUPLE \ -) - -#define HeapTupleHeaderHasMatch(tup) \ -( \ - (tup)->t_infomask2 & HEAP_TUPLE_HAS_MATCH \ -) - -#define HeapTupleHeaderSetMatch(tup) \ -( \ - (tup)->t_infomask2 |= HEAP_TUPLE_HAS_MATCH \ -) - -#define HeapTupleHeaderClearMatch(tup) \ -( \ - (tup)->t_infomask2 &= ~HEAP_TUPLE_HAS_MATCH \ -) - -#define HeapTupleHeaderGetNatts(tup) \ - ((tup)->t_infomask2 & HEAP_NATTS_MASK) - -#define HeapTupleHeaderSetNatts(tup, natts) \ -( \ - (tup)->t_infomask2 = ((tup)->t_infomask2 & ~HEAP_NATTS_MASK) | (natts) \ -) - - -/* - * BITMAPLEN(NATTS) - - * Computes size of null bitmap given number of data columns. - */ -#define BITMAPLEN(NATTS) (((int)(NATTS) + 7) / 8) - -/* - * MaxHeapTupleSize is the maximum allowed size of a heap tuple, including - * header and MAXALIGN alignment padding. Basically it's BLCKSZ minus the - * other stuff that has to be on a disk page. Since heap pages use no - * "special space", there's no deduction for that. - * - * NOTE: we allow for the ItemId that must point to the tuple, ensuring that - * an otherwise-empty page can indeed hold a tuple of this size. Because - * ItemIds and tuples have different alignment requirements, don't assume that - * you can, say, fit 2 tuples of size MaxHeapTupleSize/2 on the same page. - */ -#define MaxHeapTupleSize (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData))) - -/* - * MaxHeapTuplesPerPage is an upper bound on the number of tuples that can - * fit on one heap page. (Note that indexes could have more, because they - * use a smaller tuple header.) We arrive at the divisor because each tuple - * must be maxaligned, and it must have an associated item pointer. - * - * Note: with HOT, there could theoretically be more line pointers (not actual - * tuples) than this on a heap page. However we constrain the number of line - * pointers to this anyway, to avoid excessive line-pointer bloat and not - * require increases in the size of work arrays. - */ -#define MaxHeapTuplesPerPage \ - ((int) ((BLCKSZ - SizeOfPageHeaderData) / \ - (MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData)))) - -/* - * MaxAttrSize is a somewhat arbitrary upper limit on the declared size of - * data fields of char(n) and similar types. It need not have anything - * directly to do with the *actual* upper limit of varlena values, which - * is currently 1Gb (see TOAST structures in postgres.h). I've set it - * at 10Mb which seems like a reasonable number --- tgl 8/6/00. - */ -#define MaxAttrSize (10 * 1024 * 1024) - - -/* - * MinimalTuple is an alternative representation that is used for transient - * tuples inside the executor, in places where transaction status information - * is not required, the tuple rowtype is known, and shaving off a few bytes - * is worthwhile because we need to store many tuples. The representation - * is chosen so that tuple access routines can work with either full or - * minimal tuples via a HeapTupleData pointer structure. The access routines - * see no difference, except that they must not access the transaction status - * or t_ctid fields because those aren't there. - * - * For the most part, MinimalTuples should be accessed via TupleTableSlot - * routines. These routines will prevent access to the "system columns" - * and thereby prevent accidental use of the nonexistent fields. - * - * MinimalTupleData contains a length word, some padding, and fields matching - * HeapTupleHeaderData beginning with t_infomask2. The padding is chosen so - * that offsetof(t_infomask2) is the same modulo MAXIMUM_ALIGNOF in both - * structs. This makes data alignment rules equivalent in both cases. - * - * When a minimal tuple is accessed via a HeapTupleData pointer, t_data is - * set to point MINIMAL_TUPLE_OFFSET bytes before the actual start of the - * minimal tuple --- that is, where a full tuple matching the minimal tuple's - * data would start. This trick is what makes the structs seem equivalent. - * - * Note that t_hoff is computed the same as in a full tuple, hence it includes - * the MINIMAL_TUPLE_OFFSET distance. t_len does not include that, however. - * - * MINIMAL_TUPLE_DATA_OFFSET is the offset to the first useful (non-pad) data - * other than the length word. tuplesort.c and tuplestore.c use this to avoid - * writing the padding to disk. - */ -#define MINIMAL_TUPLE_OFFSET \ - ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) / MAXIMUM_ALIGNOF * MAXIMUM_ALIGNOF) -#define MINIMAL_TUPLE_PADDING \ - ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) % MAXIMUM_ALIGNOF) -#define MINIMAL_TUPLE_DATA_OFFSET \ - offsetof(MinimalTupleData, t_infomask2) - -typedef struct MinimalTupleData -{ - uint32 t_len; /* actual length of minimal tuple */ - - char mt_padding[MINIMAL_TUPLE_PADDING]; - - /* Fields below here must match HeapTupleHeaderData! */ - - uint16 t_infomask2; /* number of attributes + various flags */ - - uint16 t_infomask; /* various flag bits, see below */ - - uint8 t_hoff; /* sizeof header incl. bitmap, padding */ - - /* ^ - 23 bytes - ^ */ - - bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */ - - /* MORE DATA FOLLOWS AT END OF STRUCT */ -} MinimalTupleData; +typedef struct MinimalTupleData MinimalTupleData; typedef MinimalTupleData *MinimalTuple; @@ -505,12 +50,12 @@ typedef MinimalTupleData *MinimalTuple; * This is the output format of heap_form_tuple and related routines. * * * Separately allocated tuple: t_data points to a palloc'd chunk that - * is not adjacent to the HeapTupleData. (This case is deprecated since + * is not adjacent to the HeapTupleData. (This case is deprecated since * it's difficult to tell apart from case #1. It should be used only in * limited contexts where the code knows that case #1 will never apply.) * * * Separately allocated minimal tuple: t_data points MINIMAL_TUPLE_OFFSET - * bytes before the start of a MinimalTuple. As with the previous case, + * bytes before the start of a MinimalTuple. As with the previous case, * this can't be told apart from case #1 by inspection; code setting up * or destroying this representation has to know what it's doing. * @@ -534,11 +79,6 @@ typedef HeapTupleData *HeapTuple; #define HEAPTUPLESIZE MAXALIGN(sizeof(HeapTupleData)) -/* - * GETSTRUCT - given a HeapTuple pointer, return address of the user data - */ -#define GETSTRUCT(TUP) ((char *) ((TUP)->t_data) + (TUP)->t_data->t_hoff) - #ifdef XCP /* * Represents a DataRow message received from a remote node. @@ -560,396 +100,13 @@ typedef RemoteDataRowData *RemoteDataRow; */ #define HeapTupleIsValid(tuple) PointerIsValid(tuple) -#define HeapTupleHasNulls(tuple) \ - (((tuple)->t_data->t_infomask & HEAP_HASNULL) != 0) - -#define HeapTupleNoNulls(tuple) \ - (!((tuple)->t_data->t_infomask & HEAP_HASNULL)) - -#define HeapTupleHasVarWidth(tuple) \ - (((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH) != 0) - -#define HeapTupleAllFixed(tuple) \ - (!((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH)) - -#define HeapTupleHasExternal(tuple) \ - (((tuple)->t_data->t_infomask & HEAP_HASEXTERNAL) != 0) - -#define HeapTupleIsHotUpdated(tuple) \ - HeapTupleHeaderIsHotUpdated((tuple)->t_data) - -#define HeapTupleSetHotUpdated(tuple) \ - HeapTupleHeaderSetHotUpdated((tuple)->t_data) - -#define HeapTupleClearHotUpdated(tuple) \ - HeapTupleHeaderClearHotUpdated((tuple)->t_data) - -#define HeapTupleIsHeapOnly(tuple) \ - HeapTupleHeaderIsHeapOnly((tuple)->t_data) - -#define HeapTupleSetHeapOnly(tuple) \ - HeapTupleHeaderSetHeapOnly((tuple)->t_data) - -#define HeapTupleClearHeapOnly(tuple) \ - HeapTupleHeaderClearHeapOnly((tuple)->t_data) - -#define HeapTupleGetOid(tuple) \ - HeapTupleHeaderGetOid((tuple)->t_data) - -#define HeapTupleSetOid(tuple, oid) \ - HeapTupleHeaderSetOid((tuple)->t_data, (oid)) - - -/* - * WAL record definitions for heapam.c's WAL operations - * - * XLOG allows to store some information in high 4 bits of log - * record xl_info field. We use 3 for opcode and one for init bit. - */ -#define XLOG_HEAP_INSERT 0x00 -#define XLOG_HEAP_DELETE 0x10 -#define XLOG_HEAP_UPDATE 0x20 -/* 0x030 is free, was XLOG_HEAP_MOVE */ -#define XLOG_HEAP_HOT_UPDATE 0x40 -#define XLOG_HEAP_NEWPAGE 0x50 -#define XLOG_HEAP_LOCK 0x60 -#define XLOG_HEAP_INPLACE 0x70 - -#define XLOG_HEAP_OPMASK 0x70 -/* - * When we insert 1st item on new page in INSERT, UPDATE, HOT_UPDATE, - * or MULTI_INSERT, we can (and we do) restore entire page in redo - */ -#define XLOG_HEAP_INIT_PAGE 0x80 -/* - * We ran out of opcodes, so heapam.c now has a second RmgrId. These opcodes - * are associated with RM_HEAP2_ID, but are not logically different from - * the ones above associated with RM_HEAP_ID. XLOG_HEAP_OPMASK applies to - * these, too. - */ -#define XLOG_HEAP2_FREEZE 0x00 -#define XLOG_HEAP2_CLEAN 0x10 -/* 0x20 is free, was XLOG_HEAP2_CLEAN_MOVE */ -#define XLOG_HEAP2_CLEANUP_INFO 0x30 -#define XLOG_HEAP2_VISIBLE 0x40 -#define XLOG_HEAP2_MULTI_INSERT 0x50 - -/* - * All what we need to find changed tuple - * - * NB: on most machines, sizeof(xl_heaptid) will include some trailing pad - * bytes for alignment. We don't want to store the pad space in the XLOG, - * so use SizeOfHeapTid for space calculations. Similar comments apply for - * the other xl_FOO structs. - */ -typedef struct xl_heaptid -{ - RelFileNode node; - ItemPointerData tid; /* changed tuple id */ -} xl_heaptid; - -#define SizeOfHeapTid (offsetof(xl_heaptid, tid) + SizeOfIptrData) - -/* This is what we need to know about delete */ -typedef struct xl_heap_delete -{ - xl_heaptid target; /* deleted tuple id */ - bool all_visible_cleared; /* PD_ALL_VISIBLE was cleared */ -} xl_heap_delete; - -#define SizeOfHeapDelete (offsetof(xl_heap_delete, all_visible_cleared) + sizeof(bool)) - -/* - * We don't store the whole fixed part (HeapTupleHeaderData) of an inserted - * or updated tuple in WAL; we can save a few bytes by reconstructing the - * fields that are available elsewhere in the WAL record, or perhaps just - * plain needn't be reconstructed. These are the fields we must store. - * NOTE: t_hoff could be recomputed, but we may as well store it because - * it will come for free due to alignment considerations. - */ -typedef struct xl_heap_header -{ - uint16 t_infomask2; - uint16 t_infomask; - uint8 t_hoff; -} xl_heap_header; - -#define SizeOfHeapHeader (offsetof(xl_heap_header, t_hoff) + sizeof(uint8)) - -/* This is what we need to know about insert */ -typedef struct xl_heap_insert -{ - xl_heaptid target; /* inserted tuple id */ - bool all_visible_cleared; /* PD_ALL_VISIBLE was cleared */ - /* xl_heap_header & TUPLE DATA FOLLOWS AT END OF STRUCT */ -} xl_heap_insert; - -#define SizeOfHeapInsert (offsetof(xl_heap_insert, all_visible_cleared) + sizeof(bool)) - -/* - * This is what we need to know about a multi-insert. The record consists of - * xl_heap_multi_insert header, followed by a xl_multi_insert_tuple and tuple - * data for each tuple. 'offsets' array is omitted if the whole page is - * reinitialized (XLOG_HEAP_INIT_PAGE) - */ -typedef struct xl_heap_multi_insert -{ - RelFileNode node; - BlockNumber blkno; - bool all_visible_cleared; - uint16 ntuples; - OffsetNumber offsets[1]; - - /* TUPLE DATA (xl_multi_insert_tuples) FOLLOW AT END OF STRUCT */ -} xl_heap_multi_insert; - -#define SizeOfHeapMultiInsert offsetof(xl_heap_multi_insert, offsets) - -typedef struct xl_multi_insert_tuple -{ - uint16 datalen; /* size of tuple data that follows */ - uint16 t_infomask2; - uint16 t_infomask; - uint8 t_hoff; - /* TUPLE DATA FOLLOWS AT END OF STRUCT */ -} xl_multi_insert_tuple; - -#define SizeOfMultiInsertTuple (offsetof(xl_multi_insert_tuple, t_hoff) + sizeof(uint8)) - -/* This is what we need to know about update|hot_update */ -typedef struct xl_heap_update -{ - xl_heaptid target; /* deleted tuple id */ - ItemPointerData newtid; /* new inserted tuple id */ - bool all_visible_cleared; /* PD_ALL_VISIBLE was cleared */ - bool new_all_visible_cleared; /* same for the page of newtid */ - /* NEW TUPLE xl_heap_header AND TUPLE DATA FOLLOWS AT END OF STRUCT */ -} xl_heap_update; - -#define SizeOfHeapUpdate (offsetof(xl_heap_update, new_all_visible_cleared) + sizeof(bool)) - -/* - * This is what we need to know about vacuum page cleanup/redirect - * - * The array of OffsetNumbers following the fixed part of the record contains: - * * for each redirected item: the item offset, then the offset redirected to - * * for each now-dead item: the item offset - * * for each now-unused item: the item offset - * The total number of OffsetNumbers is therefore 2*nredirected+ndead+nunused. - * Note that nunused is not explicitly stored, but may be found by reference - * to the total record length. - */ -typedef struct xl_heap_clean -{ - RelFileNode node; - BlockNumber block; - TransactionId latestRemovedXid; - uint16 nredirected; - uint16 ndead; - /* OFFSET NUMBERS FOLLOW */ -} xl_heap_clean; - -#define SizeOfHeapClean (offsetof(xl_heap_clean, ndead) + sizeof(uint16)) - -/* - * Cleanup_info is required in some cases during a lazy VACUUM. - * Used for reporting the results of HeapTupleHeaderAdvanceLatestRemovedXid() - * see vacuumlazy.c for full explanation - */ -typedef struct xl_heap_cleanup_info -{ - RelFileNode node; - TransactionId latestRemovedXid; -} xl_heap_cleanup_info; - -#define SizeOfHeapCleanupInfo (sizeof(xl_heap_cleanup_info)) - -/* This is for replacing a page's contents in toto */ -/* NB: this is used for indexes as well as heaps */ -typedef struct xl_heap_newpage -{ - RelFileNode node; - ForkNumber forknum; - BlockNumber blkno; /* location of new page */ - /* entire page contents follow at end of record */ -} xl_heap_newpage; - -#define SizeOfHeapNewpage (offsetof(xl_heap_newpage, blkno) + sizeof(BlockNumber)) - -/* This is what we need to know about lock */ -typedef struct xl_heap_lock -{ - xl_heaptid target; /* locked tuple id */ - TransactionId locking_xid; /* might be a MultiXactId not xid */ - bool xid_is_mxact; /* is it? */ - bool shared_lock; /* shared or exclusive row lock? */ -} xl_heap_lock; - -#define SizeOfHeapLock (offsetof(xl_heap_lock, shared_lock) + sizeof(bool)) - -/* This is what we need to know about in-place update */ -typedef struct xl_heap_inplace -{ - xl_heaptid target; /* updated tuple id */ - /* TUPLE DATA FOLLOWS AT END OF STRUCT */ -} xl_heap_inplace; - -#define SizeOfHeapInplace (offsetof(xl_heap_inplace, target) + SizeOfHeapTid) - -/* This is what we need to know about tuple freezing during vacuum */ -typedef struct xl_heap_freeze -{ - RelFileNode node; - BlockNumber block; - TransactionId cutoff_xid; - /* TUPLE OFFSET NUMBERS FOLLOW AT THE END */ -} xl_heap_freeze; - -#define SizeOfHeapFreeze (offsetof(xl_heap_freeze, cutoff_xid) + sizeof(TransactionId)) - -/* This is what we need to know about setting a visibility map bit */ -typedef struct xl_heap_visible -{ - RelFileNode node; - BlockNumber block; - TransactionId cutoff_xid; -} xl_heap_visible; - -#define SizeOfHeapVisible (offsetof(xl_heap_visible, cutoff_xid) + sizeof(TransactionId)) - -extern void HeapTupleHeaderAdvanceLatestRemovedXid(HeapTupleHeader tuple, - TransactionId *latestRemovedXid); - /* HeapTupleHeader functions implemented in utils/time/combocid.c */ extern CommandId HeapTupleHeaderGetCmin(HeapTupleHeader tup); extern CommandId HeapTupleHeaderGetCmax(HeapTupleHeader tup); extern void HeapTupleHeaderAdjustCmax(HeapTupleHeader tup, - CommandId *cmax, - bool *iscombo); - -/* ---------------- - * fastgetattr - * - * Fetch a user attribute's value as a Datum (might be either a - * value, or a pointer into the data area of the tuple). - * - * This must not be used when a system attribute might be requested. - * Furthermore, the passed attnum MUST be valid. Use heap_getattr() - * instead, if in doubt. - * - * This gets called many times, so we macro the cacheable and NULL - * lookups, and call nocachegetattr() for the rest. - * ---------------- - */ - -#if !defined(DISABLE_COMPLEX_MACRO) - -#define fastgetattr(tup, attnum, tupleDesc, isnull) \ -( \ - AssertMacro((attnum) > 0), \ - (*(isnull) = false), \ - HeapTupleNoNulls(tup) ? \ - ( \ - (tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ? \ - ( \ - fetchatt((tupleDesc)->attrs[(attnum)-1], \ - (char *) (tup)->t_data + (tup)->t_data->t_hoff + \ - (tupleDesc)->attrs[(attnum)-1]->attcacheoff) \ - ) \ - : \ - nocachegetattr((tup), (attnum), (tupleDesc)) \ - ) \ - : \ - ( \ - att_isnull((attnum)-1, (tup)->t_data->t_bits) ? \ - ( \ - (*(isnull) = true), \ - (Datum)NULL \ - ) \ - : \ - ( \ - nocachegetattr((tup), (attnum), (tupleDesc)) \ - ) \ - ) \ -) -#else /* defined(DISABLE_COMPLEX_MACRO) */ - -extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, - bool *isnull); -#endif /* defined(DISABLE_COMPLEX_MACRO) */ - - -/* ---------------- - * heap_getattr - * - * Extract an attribute of a heap tuple and return it as a Datum. - * This works for either system or user attributes. The given attnum - * is properly range-checked. - * - * If the field in question has a NULL value, we return a zero Datum - * and set *isnull == true. Otherwise, we set *isnull == false. - * - * <tup> is the pointer to the heap tuple. <attnum> is the attribute - * number of the column (field) caller wants. <tupleDesc> is a - * pointer to the structure describing the row and all its fields. - * ---------------- - */ -#define heap_getattr(tup, attnum, tupleDesc, isnull) \ - ( \ - ((attnum) > 0) ? \ - ( \ - ((attnum) > (int) HeapTupleHeaderGetNatts((tup)->t_data)) ? \ - ( \ - (*(isnull) = true), \ - (Datum)NULL \ - ) \ - : \ - fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \ - ) \ - : \ - heap_getsysattr((tup), (attnum), (tupleDesc), (isnull)) \ - ) - -/* prototypes for functions in common/heaptuple.c */ -extern Size heap_compute_data_size(TupleDesc tupleDesc, - Datum *values, bool *isnull); -extern void heap_fill_tuple(TupleDesc tupleDesc, - Datum *values, bool *isnull, - char *data, Size data_size, - uint16 *infomask, bits8 *bit); -extern bool heap_attisnull(HeapTuple tup, int attnum); -extern Datum nocachegetattr(HeapTuple tup, int attnum, - TupleDesc att); -extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, - bool *isnull); -extern HeapTuple heap_copytuple(HeapTuple tuple); -extern void heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest); -extern HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, - Datum *values, bool *isnull); -extern HeapTuple heap_modify_tuple(HeapTuple tuple, - TupleDesc tupleDesc, - Datum *replValues, - bool *replIsnull, - bool *doReplace); -extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, - Datum *values, bool *isnull); + CommandId *cmax, bool *iscombo); -/* these three are deprecated versions of the three above: */ -extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor, - Datum *values, char *nulls); -extern HeapTuple heap_modifytuple(HeapTuple tuple, - TupleDesc tupleDesc, - Datum *replValues, - char *replNulls, - char *replActions); -extern void heap_deformtuple(HeapTuple tuple, TupleDesc tupleDesc, - Datum *values, char *nulls); -extern void heap_freetuple(HeapTuple htup); -extern MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor, - Datum *values, bool *isnull); -extern void heap_free_minimal_tuple(MinimalTuple mtup); -extern MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup); -extern HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup); -extern MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup); +/* Prototype for HeapTupleHeader accessors in heapam.c */ +extern TransactionId HeapTupleGetUpdateXid(HeapTupleHeader tuple); #endif /* HTUP_H */ diff --git a/src/include/access/htup_details.h b/src/include/access/htup_details.h new file mode 100644 index 0000000000..294d21bd18 --- /dev/null +++ b/src/include/access/htup_details.h @@ -0,0 +1,765 @@ +/*------------------------------------------------------------------------- + * + * htup_details.h + * POSTGRES heap tuple header definitions. + * + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/htup_details.h + * + *------------------------------------------------------------------------- + */ +#ifndef HTUP_DETAILS_H +#define HTUP_DETAILS_H + +#include "access/htup.h" +#include "access/tupdesc.h" +#include "access/tupmacs.h" +#include "access/transam.h" +#include "storage/bufpage.h" + +/* + * MaxTupleAttributeNumber limits the number of (user) columns in a tuple. + * The key limit on this value is that the size of the fixed overhead for + * a tuple, plus the size of the null-values bitmap (at 1 bit per column), + * plus MAXALIGN alignment, must fit into t_hoff which is uint8. On most + * machines the upper limit without making t_hoff wider would be a little + * over 1700. We use round numbers here and for MaxHeapAttributeNumber + * so that alterations in HeapTupleHeaderData layout won't change the + * supported max number of columns. + */ +#define MaxTupleAttributeNumber 1664 /* 8 * 208 */ + +/* + * MaxHeapAttributeNumber limits the number of (user) columns in a table. + * This should be somewhat less than MaxTupleAttributeNumber. It must be + * at least one less, else we will fail to do UPDATEs on a maximal-width + * table (because UPDATE has to form working tuples that include CTID). + * In practice we want some additional daylight so that we can gracefully + * support operations that add hidden "resjunk" columns, for example + * SELECT * FROM wide_table ORDER BY foo, bar, baz. + * In any case, depending on column data types you will likely be running + * into the disk-block-based limit on overall tuple size if you have more + * than a thousand or so columns. TOAST won't help. + */ +#define MaxHeapAttributeNumber 1600 /* 8 * 200 */ + +/* + * Heap tuple header. To avoid wasting space, the fields should be + * laid out in such a way as to avoid structure padding. + * + * Datums of composite types (row types) share the same general structure + * as on-disk tuples, so that the same routines can be used to build and + * examine them. However the requirements are slightly different: a Datum + * does not need any transaction visibility information, and it does need + * a length word and some embedded type information. We can achieve this + * by overlaying the xmin/cmin/xmax/cmax/xvac fields of a heap tuple + * with the fields needed in the Datum case. Typically, all tuples built + * in-memory will be initialized with the Datum fields; but when a tuple is + * about to be inserted in a table, the transaction fields will be filled, + * overwriting the datum fields. + * + * The overall structure of a heap tuple looks like: + * fixed fields (HeapTupleHeaderData struct) + * nulls bitmap (if HEAP_HASNULL is set in t_infomask) + * alignment padding (as needed to make user data MAXALIGN'd) + * object ID (if HEAP_HASOID is set in t_infomask) + * user data fields + * + * We store five "virtual" fields Xmin, Cmin, Xmax, Cmax, and Xvac in three + * physical fields. Xmin and Xmax are always really stored, but Cmin, Cmax + * and Xvac share a field. This works because we know that Cmin and Cmax + * are only interesting for the lifetime of the inserting and deleting + * transaction respectively. If a tuple is inserted and deleted in the same + * transaction, we store a "combo" command id that can be mapped to the real + * cmin and cmax, but only by use of local state within the originating + * backend. See combocid.c for more details. Meanwhile, Xvac is only set by + * old-style VACUUM FULL, which does not have any command sub-structure and so + * does not need either Cmin or Cmax. (This requires that old-style VACUUM + * FULL never try to move a tuple whose Cmin or Cmax is still interesting, + * ie, an insert-in-progress or delete-in-progress tuple.) + * + * A word about t_ctid: whenever a new tuple is stored on disk, its t_ctid + * is initialized with its own TID (location). If the tuple is ever updated, + * its t_ctid is changed to point to the replacement version of the tuple. + * Thus, a tuple is the latest version of its row iff XMAX is invalid or + * t_ctid points to itself (in which case, if XMAX is valid, the tuple is + * either locked or deleted). One can follow the chain of t_ctid links + * to find the newest version of the row. Beware however that VACUUM might + * erase the pointed-to (newer) tuple before erasing the pointing (older) + * tuple. Hence, when following a t_ctid link, it is necessary to check + * to see if the referenced slot is empty or contains an unrelated tuple. + * Check that the referenced tuple has XMIN equal to the referencing tuple's + * XMAX to verify that it is actually the descendant version and not an + * unrelated tuple stored into a slot recently freed by VACUUM. If either + * check fails, one may assume that there is no live descendant version. + * + * Following the fixed header fields, the nulls bitmap is stored (beginning + * at t_bits). The bitmap is *not* stored if t_infomask shows that there + * are no nulls in the tuple. If an OID field is present (as indicated by + * t_infomask), then it is stored just before the user data, which begins at + * the offset shown by t_hoff. Note that t_hoff must be a multiple of + * MAXALIGN. + */ + +typedef struct HeapTupleFields +{ + TransactionId t_xmin; /* inserting xact ID */ + TransactionId t_xmax; /* deleting or locking xact ID */ + + union + { + CommandId t_cid; /* inserting or deleting command ID, or both */ + TransactionId t_xvac; /* old-style VACUUM FULL xact ID */ + } t_field3; +} HeapTupleFields; + +typedef struct DatumTupleFields +{ + int32 datum_len_; /* varlena header (do not touch directly!) */ + + int32 datum_typmod; /* -1, or identifier of a record type */ + + Oid datum_typeid; /* composite type OID, or RECORDOID */ + + /* + * Note: field ordering is chosen with thought that Oid might someday + * widen to 64 bits. + */ +} DatumTupleFields; + +struct HeapTupleHeaderData +{ + union + { + HeapTupleFields t_heap; + DatumTupleFields t_datum; + } t_choice; + + ItemPointerData t_ctid; /* current TID of this or newer tuple */ + + /* Fields below here must match MinimalTupleData! */ + + uint16 t_infomask2; /* number of attributes + various flags */ + + uint16 t_infomask; /* various flag bits, see below */ + + uint8 t_hoff; /* sizeof header incl. bitmap, padding */ + + /* ^ - 23 bytes - ^ */ + + bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */ + + /* MORE DATA FOLLOWS AT END OF STRUCT */ +}; + +/* typedef appears in tupbasics.h */ + +/* + * information stored in t_infomask: + */ +#define HEAP_HASNULL 0x0001 /* has null attribute(s) */ +#define HEAP_HASVARWIDTH 0x0002 /* has variable-width attribute(s) */ +#define HEAP_HASEXTERNAL 0x0004 /* has external stored attribute(s) */ +#define HEAP_HASOID 0x0008 /* has an object-id field */ +#define HEAP_XMAX_KEYSHR_LOCK 0x0010 /* xmax is a key-shared locker */ +#define HEAP_COMBOCID 0x0020 /* t_cid is a combo cid */ +#define HEAP_XMAX_EXCL_LOCK 0x0040 /* xmax is exclusive locker */ +#define HEAP_XMAX_LOCK_ONLY 0x0080 /* xmax, if valid, is only a locker */ + + /* xmax is a shared locker */ +#define HEAP_XMAX_SHR_LOCK (HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_KEYSHR_LOCK) + +#define HEAP_LOCK_MASK (HEAP_XMAX_SHR_LOCK | HEAP_XMAX_EXCL_LOCK | \ + HEAP_XMAX_KEYSHR_LOCK) +#define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */ +#define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */ +#define HEAP_XMIN_FROZEN (HEAP_XMIN_COMMITTED|HEAP_XMIN_INVALID) +#define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */ +#define HEAP_XMAX_INVALID 0x0800 /* t_xmax invalid/aborted */ +#define HEAP_XMAX_IS_MULTI 0x1000 /* t_xmax is a MultiXactId */ +#define HEAP_UPDATED 0x2000 /* this is UPDATEd version of row */ +#define HEAP_MOVED_OFF 0x4000 /* moved to another place by pre-9.0 + * VACUUM FULL; kept for binary + * upgrade support */ +#define HEAP_MOVED_IN 0x8000 /* moved from another place by pre-9.0 + * VACUUM FULL; kept for binary + * upgrade support */ +#define HEAP_MOVED (HEAP_MOVED_OFF | HEAP_MOVED_IN) + +#define HEAP_XACT_MASK 0xFFF0 /* visibility-related bits */ + +/* + * A tuple is only locked (i.e. not updated by its Xmax) if the + * HEAP_XMAX_LOCK_ONLY bit is set; or, for pg_upgrade's sake, if the Xmax is + * not a multi and the EXCL_LOCK bit is set. + * + * See also HeapTupleHeaderIsOnlyLocked, which also checks for a possible + * aborted updater transaction. + * + * Beware of multiple evaluations of the argument. + */ +#define HEAP_XMAX_IS_LOCKED_ONLY(infomask) \ + (((infomask) & HEAP_XMAX_LOCK_ONLY) || \ + (((infomask) & (HEAP_XMAX_IS_MULTI | HEAP_LOCK_MASK)) == HEAP_XMAX_EXCL_LOCK)) + +/* + * Use these to test whether a particular lock is applied to a tuple + */ +#define HEAP_XMAX_IS_SHR_LOCKED(infomask) \ + (((infomask) & HEAP_LOCK_MASK) == HEAP_XMAX_SHR_LOCK) +#define HEAP_XMAX_IS_EXCL_LOCKED(infomask) \ + (((infomask) & HEAP_LOCK_MASK) == HEAP_XMAX_EXCL_LOCK) +#define HEAP_XMAX_IS_KEYSHR_LOCKED(infomask) \ + (((infomask) & HEAP_LOCK_MASK) == HEAP_XMAX_KEYSHR_LOCK) + +/* turn these all off when Xmax is to change */ +#define HEAP_XMAX_BITS (HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID | \ + HEAP_XMAX_IS_MULTI | HEAP_LOCK_MASK | HEAP_XMAX_LOCK_ONLY) + +/* + * information stored in t_infomask2: + */ +#define HEAP_NATTS_MASK 0x07FF /* 11 bits for number of attributes */ +/* bits 0x1800 are available */ +#define HEAP_KEYS_UPDATED 0x2000 /* tuple was updated and key cols + * modified, or tuple deleted */ +#define HEAP_HOT_UPDATED 0x4000 /* tuple was HOT-updated */ +#define HEAP_ONLY_TUPLE 0x8000 /* this is heap-only tuple */ + +#define HEAP2_XACT_MASK 0xE000 /* visibility-related bits */ + +/* + * HEAP_TUPLE_HAS_MATCH is a temporary flag used during hash joins. It is + * only used in tuples that are in the hash table, and those don't need + * any visibility information, so we can overlay it on a visibility flag + * instead of using up a dedicated bit. + */ +#define HEAP_TUPLE_HAS_MATCH HEAP_ONLY_TUPLE /* tuple has a join match */ + +/* + * HeapTupleHeader accessor macros + * + * Note: beware of multiple evaluations of "tup" argument. But the Set + * macros evaluate their other argument only once. + */ + +/* + * HeapTupleHeaderGetRawXmin returns the "raw" xmin field, which is the xid + * originally used to insert the tuple. However, the tuple might actually + * be frozen (via HeapTupleHeaderSetXminFrozen) in which case the tuple's xmin + * is visible to every snapshot. Prior to PostgreSQL 9.4, we actually changed + * the xmin to FrozenTransactionId, and that value may still be encountered + * on disk. + */ +#define HeapTupleHeaderGetRawXmin(tup) \ +( \ + (tup)->t_choice.t_heap.t_xmin \ +) + +#define HeapTupleHeaderGetXmin(tup) \ +( \ + HeapTupleHeaderXminFrozen(tup) ? \ + FrozenTransactionId : HeapTupleHeaderGetRawXmin(tup) \ +) + +#define HeapTupleHeaderSetXmin(tup, xid) \ +( \ + (tup)->t_choice.t_heap.t_xmin = (xid) \ +) + +#define HeapTupleHeaderXminCommitted(tup) \ +( \ + (tup)->t_infomask & HEAP_XMIN_COMMITTED \ +) + +#define HeapTupleHeaderXminInvalid(tup) \ +( \ + ((tup)->t_infomask & (HEAP_XMIN_COMMITTED|HEAP_XMIN_INVALID)) == \ + HEAP_XMIN_INVALID \ +) + +#define HeapTupleHeaderXminFrozen(tup) \ +( \ + ((tup)->t_infomask & (HEAP_XMIN_FROZEN)) == HEAP_XMIN_FROZEN \ +) + +#define HeapTupleHeaderSetXminCommitted(tup) \ +( \ + AssertMacro(!HeapTupleHeaderXminInvalid(tup)), \ + ((tup)->t_infomask |= HEAP_XMIN_COMMITTED) \ +) + +#define HeapTupleHeaderSetXminInvalid(tup) \ +( \ + AssertMacro(!HeapTupleHeaderXminCommitted(tup)), \ + ((tup)->t_infomask |= HEAP_XMIN_INVALID) \ +) + +#define HeapTupleHeaderSetXminFrozen(tup) \ +( \ + AssertMacro(!HeapTupleHeaderXminInvalid(tup)), \ + ((tup)->t_infomask |= HEAP_XMIN_FROZEN) \ +) + +/* + * HeapTupleHeaderGetRawXmax gets you the raw Xmax field. To find out the Xid + * that updated a tuple, you might need to resolve the MultiXactId if certain + * bits are set. HeapTupleHeaderGetUpdateXid checks those bits and takes care + * to resolve the MultiXactId if necessary. This might involve multixact I/O, + * so it should only be used if absolutely necessary. + */ +#define HeapTupleHeaderGetUpdateXid(tup) \ +( \ + (!((tup)->t_infomask & HEAP_XMAX_INVALID) && \ + ((tup)->t_infomask & HEAP_XMAX_IS_MULTI) && \ + !((tup)->t_infomask & HEAP_XMAX_LOCK_ONLY)) ? \ + HeapTupleGetUpdateXid(tup) \ + : \ + HeapTupleHeaderGetRawXmax(tup) \ +) + +#define HeapTupleHeaderGetRawXmax(tup) \ +( \ + (tup)->t_choice.t_heap.t_xmax \ +) + +#define HeapTupleHeaderSetXmax(tup, xid) \ +( \ + (tup)->t_choice.t_heap.t_xmax = (xid) \ +) + +/* + * HeapTupleHeaderGetRawCommandId will give you what's in the header whether + * it is useful or not. Most code should use HeapTupleHeaderGetCmin or + * HeapTupleHeaderGetCmax instead, but note that those Assert that you can + * get a legitimate result, ie you are in the originating transaction! + */ +#define HeapTupleHeaderGetRawCommandId(tup) \ +( \ + (tup)->t_choice.t_heap.t_field3.t_cid \ +) + +/* SetCmin is reasonably simple since we never need a combo CID */ +#define HeapTupleHeaderSetCmin(tup, cid) \ +do { \ + Assert(!((tup)->t_infomask & HEAP_MOVED)); \ + (tup)->t_choice.t_heap.t_field3.t_cid = (cid); \ + (tup)->t_infomask &= ~HEAP_COMBOCID; \ +} while (0) + +/* SetCmax must be used after HeapTupleHeaderAdjustCmax; see combocid.c */ +#define HeapTupleHeaderSetCmax(tup, cid, iscombo) \ +do { \ + Assert(!((tup)->t_infomask & HEAP_MOVED)); \ + (tup)->t_choice.t_heap.t_field3.t_cid = (cid); \ + if (iscombo) \ + (tup)->t_infomask |= HEAP_COMBOCID; \ + else \ + (tup)->t_infomask &= ~HEAP_COMBOCID; \ +} while (0) + +#define HeapTupleHeaderGetXvac(tup) \ +( \ + ((tup)->t_infomask & HEAP_MOVED) ? \ + (tup)->t_choice.t_heap.t_field3.t_xvac \ + : \ + InvalidTransactionId \ +) + +#define HeapTupleHeaderSetXvac(tup, xid) \ +do { \ + Assert((tup)->t_infomask & HEAP_MOVED); \ + (tup)->t_choice.t_heap.t_field3.t_xvac = (xid); \ +} while (0) + +#define HeapTupleHeaderGetDatumLength(tup) \ + VARSIZE(tup) + +#define HeapTupleHeaderSetDatumLength(tup, len) \ + SET_VARSIZE(tup, len) + +#define HeapTupleHeaderGetTypeId(tup) \ +( \ + (tup)->t_choice.t_datum.datum_typeid \ +) + +#define HeapTupleHeaderSetTypeId(tup, typeid) \ +( \ + (tup)->t_choice.t_datum.datum_typeid = (typeid) \ +) + +#define HeapTupleHeaderGetTypMod(tup) \ +( \ + (tup)->t_choice.t_datum.datum_typmod \ +) + +#define HeapTupleHeaderSetTypMod(tup, typmod) \ +( \ + (tup)->t_choice.t_datum.datum_typmod = (typmod) \ +) + +#define HeapTupleHeaderGetOid(tup) \ +( \ + ((tup)->t_infomask & HEAP_HASOID) ? \ + *((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) \ + : \ + InvalidOid \ +) + +#define HeapTupleHeaderSetOid(tup, oid) \ +do { \ + Assert((tup)->t_infomask & HEAP_HASOID); \ + *((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) = (oid); \ +} while (0) + +/* + * Note that we stop considering a tuple HOT-updated as soon as it is known + * aborted or the would-be updating transaction is known aborted. For best + * efficiency, check tuple visibility before using this macro, so that the + * INVALID bits will be as up to date as possible. + */ +#define HeapTupleHeaderIsHotUpdated(tup) \ +( \ + ((tup)->t_infomask2 & HEAP_HOT_UPDATED) != 0 && \ + ((tup)->t_infomask & HEAP_XMAX_INVALID) == 0 && \ + !HeapTupleHeaderXminInvalid(tup) \ +) + +#define HeapTupleHeaderSetHotUpdated(tup) \ +( \ + (tup)->t_infomask2 |= HEAP_HOT_UPDATED \ +) + +#define HeapTupleHeaderClearHotUpdated(tup) \ +( \ + (tup)->t_infomask2 &= ~HEAP_HOT_UPDATED \ +) + +#define HeapTupleHeaderIsHeapOnly(tup) \ +( \ + (tup)->t_infomask2 & HEAP_ONLY_TUPLE \ +) + +#define HeapTupleHeaderSetHeapOnly(tup) \ +( \ + (tup)->t_infomask2 |= HEAP_ONLY_TUPLE \ +) + +#define HeapTupleHeaderClearHeapOnly(tup) \ +( \ + (tup)->t_infomask2 &= ~HEAP_ONLY_TUPLE \ +) + +#define HeapTupleHeaderHasMatch(tup) \ +( \ + (tup)->t_infomask2 & HEAP_TUPLE_HAS_MATCH \ +) + +#define HeapTupleHeaderSetMatch(tup) \ +( \ + (tup)->t_infomask2 |= HEAP_TUPLE_HAS_MATCH \ +) + +#define HeapTupleHeaderClearMatch(tup) \ +( \ + (tup)->t_infomask2 &= ~HEAP_TUPLE_HAS_MATCH \ +) + +#define HeapTupleHeaderGetNatts(tup) \ + ((tup)->t_infomask2 & HEAP_NATTS_MASK) + +#define HeapTupleHeaderSetNatts(tup, natts) \ +( \ + (tup)->t_infomask2 = ((tup)->t_infomask2 & ~HEAP_NATTS_MASK) | (natts) \ +) + +#define HeapTupleHeaderHasExternal(tup) \ + (((tup)->t_infomask & HEAP_HASEXTERNAL) != 0) + + +/* + * BITMAPLEN(NATTS) - + * Computes size of null bitmap given number of data columns. + */ +#define BITMAPLEN(NATTS) (((int)(NATTS) + 7) / 8) + +/* + * MaxHeapTupleSize is the maximum allowed size of a heap tuple, including + * header and MAXALIGN alignment padding. Basically it's BLCKSZ minus the + * other stuff that has to be on a disk page. Since heap pages use no + * "special space", there's no deduction for that. + * + * NOTE: we allow for the ItemId that must point to the tuple, ensuring that + * an otherwise-empty page can indeed hold a tuple of this size. Because + * ItemIds and tuples have different alignment requirements, don't assume that + * you can, say, fit 2 tuples of size MaxHeapTupleSize/2 on the same page. + */ +#define MaxHeapTupleSize (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData))) + +/* + * MaxHeapTuplesPerPage is an upper bound on the number of tuples that can + * fit on one heap page. (Note that indexes could have more, because they + * use a smaller tuple header.) We arrive at the divisor because each tuple + * must be maxaligned, and it must have an associated item pointer. + * + * Note: with HOT, there could theoretically be more line pointers (not actual + * tuples) than this on a heap page. However we constrain the number of line + * pointers to this anyway, to avoid excessive line-pointer bloat and not + * require increases in the size of work arrays. + */ +#define MaxHeapTuplesPerPage \ + ((int) ((BLCKSZ - SizeOfPageHeaderData) / \ + (MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData)))) + +/* + * MaxAttrSize is a somewhat arbitrary upper limit on the declared size of + * data fields of char(n) and similar types. It need not have anything + * directly to do with the *actual* upper limit of varlena values, which + * is currently 1Gb (see TOAST structures in postgres.h). I've set it + * at 10Mb which seems like a reasonable number --- tgl 8/6/00. + */ +#define MaxAttrSize (10 * 1024 * 1024) + + +/* + * MinimalTuple is an alternative representation that is used for transient + * tuples inside the executor, in places where transaction status information + * is not required, the tuple rowtype is known, and shaving off a few bytes + * is worthwhile because we need to store many tuples. The representation + * is chosen so that tuple access routines can work with either full or + * minimal tuples via a HeapTupleData pointer structure. The access routines + * see no difference, except that they must not access the transaction status + * or t_ctid fields because those aren't there. + * + * For the most part, MinimalTuples should be accessed via TupleTableSlot + * routines. These routines will prevent access to the "system columns" + * and thereby prevent accidental use of the nonexistent fields. + * + * MinimalTupleData contains a length word, some padding, and fields matching + * HeapTupleHeaderData beginning with t_infomask2. The padding is chosen so + * that offsetof(t_infomask2) is the same modulo MAXIMUM_ALIGNOF in both + * structs. This makes data alignment rules equivalent in both cases. + * + * When a minimal tuple is accessed via a HeapTupleData pointer, t_data is + * set to point MINIMAL_TUPLE_OFFSET bytes before the actual start of the + * minimal tuple --- that is, where a full tuple matching the minimal tuple's + * data would start. This trick is what makes the structs seem equivalent. + * + * Note that t_hoff is computed the same as in a full tuple, hence it includes + * the MINIMAL_TUPLE_OFFSET distance. t_len does not include that, however. + * + * MINIMAL_TUPLE_DATA_OFFSET is the offset to the first useful (non-pad) data + * other than the length word. tuplesort.c and tuplestore.c use this to avoid + * writing the padding to disk. + */ +#define MINIMAL_TUPLE_OFFSET \ + ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) / MAXIMUM_ALIGNOF * MAXIMUM_ALIGNOF) +#define MINIMAL_TUPLE_PADDING \ + ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) % MAXIMUM_ALIGNOF) +#define MINIMAL_TUPLE_DATA_OFFSET \ + offsetof(MinimalTupleData, t_infomask2) + +struct MinimalTupleData +{ + uint32 t_len; /* actual length of minimal tuple */ + + char mt_padding[MINIMAL_TUPLE_PADDING]; + + /* Fields below here must match HeapTupleHeaderData! */ + + uint16 t_infomask2; /* number of attributes + various flags */ + + uint16 t_infomask; /* various flag bits, see below */ + + uint8 t_hoff; /* sizeof header incl. bitmap, padding */ + + /* ^ - 23 bytes - ^ */ + + bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */ + + /* MORE DATA FOLLOWS AT END OF STRUCT */ +}; + +/* typedef appears in htup.h */ + + +/* + * GETSTRUCT - given a HeapTuple pointer, return address of the user data + */ +#define GETSTRUCT(TUP) ((char *) ((TUP)->t_data) + (TUP)->t_data->t_hoff) + +/* + * Accessor macros to be used with HeapTuple pointers. + */ + +#define HeapTupleHasNulls(tuple) \ + (((tuple)->t_data->t_infomask & HEAP_HASNULL) != 0) + +#define HeapTupleNoNulls(tuple) \ + (!((tuple)->t_data->t_infomask & HEAP_HASNULL)) + +#define HeapTupleHasVarWidth(tuple) \ + (((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH) != 0) + +#define HeapTupleAllFixed(tuple) \ + (!((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH)) + +#define HeapTupleHasExternal(tuple) \ + (((tuple)->t_data->t_infomask & HEAP_HASEXTERNAL) != 0) + +#define HeapTupleIsHotUpdated(tuple) \ + HeapTupleHeaderIsHotUpdated((tuple)->t_data) + +#define HeapTupleSetHotUpdated(tuple) \ + HeapTupleHeaderSetHotUpdated((tuple)->t_data) + +#define HeapTupleClearHotUpdated(tuple) \ + HeapTupleHeaderClearHotUpdated((tuple)->t_data) + +#define HeapTupleIsHeapOnly(tuple) \ + HeapTupleHeaderIsHeapOnly((tuple)->t_data) + +#define HeapTupleSetHeapOnly(tuple) \ + HeapTupleHeaderSetHeapOnly((tuple)->t_data) + +#define HeapTupleClearHeapOnly(tuple) \ + HeapTupleHeaderClearHeapOnly((tuple)->t_data) + +#define HeapTupleGetOid(tuple) \ + HeapTupleHeaderGetOid((tuple)->t_data) + +#define HeapTupleSetOid(tuple, oid) \ + HeapTupleHeaderSetOid((tuple)->t_data, (oid)) + + +/* ---------------- + * fastgetattr + * + * Fetch a user attribute's value as a Datum (might be either a + * value, or a pointer into the data area of the tuple). + * + * This must not be used when a system attribute might be requested. + * Furthermore, the passed attnum MUST be valid. Use heap_getattr() + * instead, if in doubt. + * + * This gets called many times, so we macro the cacheable and NULL + * lookups, and call nocachegetattr() for the rest. + * ---------------- + */ + +#if !defined(DISABLE_COMPLEX_MACRO) + +#define fastgetattr(tup, attnum, tupleDesc, isnull) \ +( \ + AssertMacro((attnum) > 0), \ + (*(isnull) = false), \ + HeapTupleNoNulls(tup) ? \ + ( \ + (tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ? \ + ( \ + fetchatt((tupleDesc)->attrs[(attnum)-1], \ + (char *) (tup)->t_data + (tup)->t_data->t_hoff + \ + (tupleDesc)->attrs[(attnum)-1]->attcacheoff) \ + ) \ + : \ + nocachegetattr((tup), (attnum), (tupleDesc)) \ + ) \ + : \ + ( \ + att_isnull((attnum)-1, (tup)->t_data->t_bits) ? \ + ( \ + (*(isnull) = true), \ + (Datum)NULL \ + ) \ + : \ + ( \ + nocachegetattr((tup), (attnum), (tupleDesc)) \ + ) \ + ) \ +) +#else /* defined(DISABLE_COMPLEX_MACRO) */ + +extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, + bool *isnull); +#endif /* defined(DISABLE_COMPLEX_MACRO) */ + + +/* ---------------- + * heap_getattr + * + * Extract an attribute of a heap tuple and return it as a Datum. + * This works for either system or user attributes. The given attnum + * is properly range-checked. + * + * If the field in question has a NULL value, we return a zero Datum + * and set *isnull == true. Otherwise, we set *isnull == false. + * + * <tup> is the pointer to the heap tuple. <attnum> is the attribute + * number of the column (field) caller wants. <tupleDesc> is a + * pointer to the structure describing the row and all its fields. + * ---------------- + */ +#define heap_getattr(tup, attnum, tupleDesc, isnull) \ + ( \ + ((attnum) > 0) ? \ + ( \ + ((attnum) > (int) HeapTupleHeaderGetNatts((tup)->t_data)) ? \ + ( \ + (*(isnull) = true), \ + (Datum)NULL \ + ) \ + : \ + fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \ + ) \ + : \ + heap_getsysattr((tup), (attnum), (tupleDesc), (isnull)) \ + ) + + +/* prototypes for functions in common/heaptuple.c */ +extern Size heap_compute_data_size(TupleDesc tupleDesc, + Datum *values, bool *isnull); +extern void heap_fill_tuple(TupleDesc tupleDesc, + Datum *values, bool *isnull, + char *data, Size data_size, + uint16 *infomask, bits8 *bit); +extern bool heap_attisnull(HeapTuple tup, int attnum); +extern Datum nocachegetattr(HeapTuple tup, int attnum, + TupleDesc att); +extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, + bool *isnull); +extern HeapTuple heap_copytuple(HeapTuple tuple); +extern void heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest); +extern Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc); +extern HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, + Datum *values, bool *isnull); +extern HeapTuple heap_modify_tuple(HeapTuple tuple, + TupleDesc tupleDesc, + Datum *replValues, + bool *replIsnull, + bool *doReplace); +extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, + Datum *values, bool *isnull); + +/* these three are deprecated versions of the three above: */ +extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor, + Datum *values, char *nulls); +extern HeapTuple heap_modifytuple(HeapTuple tuple, + TupleDesc tupleDesc, + Datum *replValues, + char *replNulls, + char *replActions); +extern void heap_deformtuple(HeapTuple tuple, TupleDesc tupleDesc, + Datum *values, char *nulls); +extern void heap_freetuple(HeapTuple htup); +extern MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor, + Datum *values, bool *isnull); +extern void heap_free_minimal_tuple(MinimalTuple mtup); +extern MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup); +extern HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup); +extern MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup); + +#endif /* HTUP_DETAILS_H */ diff --git a/src/include/access/itup.h b/src/include/access/itup.h index 2f04b871a4..de17936b10 100644 --- a/src/include/access/itup.h +++ b/src/include/access/itup.h @@ -4,7 +4,7 @@ * POSTGRES index tuple definitions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/itup.h @@ -22,7 +22,7 @@ /* * Index tuple header structure * - * All index tuples start with IndexTupleData. If the HasNulls bit is set, + * All index tuples start with IndexTupleData. If the HasNulls bit is set, * this is followed by an IndexAttributeBitMapData. The index attribute * values follow, beginning at a MAXALIGN boundary. * diff --git a/src/include/access/multixact.h b/src/include/access/multixact.h index e20573d01f..80c70748cf 100644 --- a/src/include/access/multixact.h +++ b/src/include/access/multixact.h @@ -3,7 +3,7 @@ * * PostgreSQL multi-transaction-log manager * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/multixact.h @@ -13,15 +13,55 @@ #include "access/xlog.h" + +/* + * The first two MultiXactId values are reserved to store the truncation Xid + * and epoch of the first segment, so we start assigning multixact values from + * 2. + */ #define InvalidMultiXactId ((MultiXactId) 0) #define FirstMultiXactId ((MultiXactId) 1) +#define MaxMultiXactId ((MultiXactId) 0xFFFFFFFF) #define MultiXactIdIsValid(multi) ((multi) != InvalidMultiXactId) +#define MaxMultiXactOffset ((MultiXactOffset) 0xFFFFFFFF) + /* Number of SLRU buffers to use for multixact */ #define NUM_MXACTOFFSET_BUFFERS 8 #define NUM_MXACTMEMBER_BUFFERS 16 +/* + * Possible multixact lock modes ("status"). The first four modes are for + * tuple locks (FOR KEY SHARE, FOR SHARE, FOR NO KEY UPDATE, FOR UPDATE); the + * next two are used for update and delete modes. + */ +typedef enum +{ + MultiXactStatusForKeyShare = 0x00, + MultiXactStatusForShare = 0x01, + MultiXactStatusForNoKeyUpdate = 0x02, + MultiXactStatusForUpdate = 0x03, + /* an update that doesn't touch "key" columns */ + MultiXactStatusNoKeyUpdate = 0x04, + /* other updates, and delete */ + MultiXactStatusUpdate = 0x05 +} MultiXactStatus; + +#define MaxMultiXactStatus MultiXactStatusUpdate + +/* does a status value correspond to a tuple update? */ +#define ISUPDATE_from_mxstatus(status) \ + ((status) > MultiXactStatusForUpdate) + + +typedef struct MultiXactMember +{ + TransactionId xid; + MultiXactStatus status; +} MultiXactMember; + + /* ---------------- * multixact-related XLOG entries * ---------------- @@ -35,21 +75,30 @@ typedef struct xl_multixact_create { MultiXactId mid; /* new MultiXact's ID */ MultiXactOffset moff; /* its starting offset in members file */ - int32 nxids; /* number of member XIDs */ - TransactionId xids[1]; /* VARIABLE LENGTH ARRAY */ + int32 nmembers; /* number of member XIDs */ + MultiXactMember members[FLEXIBLE_ARRAY_MEMBER]; } xl_multixact_create; -#define MinSizeOfMultiXactCreate offsetof(xl_multixact_create, xids) +#define SizeOfMultiXactCreate (offsetof(xl_multixact_create, members)) + +extern MultiXactId MultiXactIdCreate(TransactionId xid1, + MultiXactStatus status1, TransactionId xid2, + MultiXactStatus status2); +extern MultiXactId MultiXactIdExpand(MultiXactId multi, TransactionId xid, + MultiXactStatus status); +extern MultiXactId MultiXactIdCreateFromMembers(int nmembers, + MultiXactMember *members); -extern MultiXactId MultiXactIdCreate(TransactionId xid1, TransactionId xid2); -extern MultiXactId MultiXactIdExpand(MultiXactId multi, TransactionId xid); +extern MultiXactId ReadNextMultiXactId(void); extern bool MultiXactIdIsRunning(MultiXactId multi); -extern bool MultiXactIdIsCurrent(MultiXactId multi); -extern void MultiXactIdWait(MultiXactId multi); -extern bool ConditionalMultiXactIdWait(MultiXactId multi); extern void MultiXactIdSetOldestMember(void); -extern int GetMultiXactIdMembers(MultiXactId multi, TransactionId **xids); +extern int GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **xids, + bool allow_old); +extern bool MultiXactHasRunningRemoteMembers(MultiXactId multi); +extern bool MultiXactIdPrecedes(MultiXactId multi1, MultiXactId multi2); +extern bool MultiXactIdPrecedesOrEquals(MultiXactId multi1, + MultiXactId multi2); extern void AtEOXact_MultiXact(void); extern void AtPrepare_MultiXact(void); @@ -59,15 +108,23 @@ extern Size MultiXactShmemSize(void); extern void MultiXactShmemInit(void); extern void BootStrapMultiXact(void); extern void StartupMultiXact(void); +extern void TrimMultiXact(void); extern void ShutdownMultiXact(void); +extern void SetMultiXactIdLimit(MultiXactId oldest_datminmxid, + Oid oldest_datoid); extern void MultiXactGetCheckptMulti(bool is_shutdown, MultiXactId *nextMulti, - MultiXactOffset *nextMultiOffset); + MultiXactOffset *nextMultiOffset, + MultiXactId *oldestMulti, + Oid *oldestMultiDB); extern void CheckPointMultiXact(void); +extern MultiXactId GetOldestMultiXactId(void); +extern void TruncateMultiXact(MultiXactId cutoff_multi); extern void MultiXactSetNextMXact(MultiXactId nextMulti, MultiXactOffset nextMultiOffset); extern void MultiXactAdvanceNextMXact(MultiXactId minMulti, MultiXactOffset minMultiOffset); +extern void MultiXactAdvanceOldest(MultiXactId oldestMulti, Oid oldestMultiDB); extern void multixact_twophase_recover(TransactionId xid, uint16 info, void *recdata, uint32 len); @@ -78,5 +135,7 @@ extern void multixact_twophase_postabort(TransactionId xid, uint16 info, extern void multixact_redo(XLogRecPtr lsn, XLogRecord *record); extern void multixact_desc(StringInfo buf, uint8 xl_info, char *rec); +extern char *mxid_to_string(MultiXactId multi, int nmembers, + MultiXactMember *members); #endif /* MULTIXACT_H */ diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index f23ac3559a..f2817590c4 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -4,7 +4,7 @@ * header file for postgres btree access method implementation. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/nbtree.h @@ -36,9 +36,9 @@ typedef uint16 BTCycleId; * and status. If the page is deleted, we replace the level with the * next-transaction-ID value indicating when it is safe to reclaim the page. * - * We also store a "vacuum cycle ID". When a page is split while VACUUM is + * We also store a "vacuum cycle ID". When a page is split while VACUUM is * processing the index, a nonzero value associated with the VACUUM run is - * stored into both halves of the split page. (If VACUUM is not running, + * stored into both halves of the split page. (If VACUUM is not running, * both pages receive zero cycleids.) This allows VACUUM to detect whether * a page was split since it started, with a small probability of false match * if the page was last split some exact multiple of MAX_BT_CYCLE_ID VACUUMs @@ -73,9 +73,10 @@ typedef BTPageOpaqueData *BTPageOpaque; #define BTP_HALF_DEAD (1 << 4) /* empty, but still in tree */ #define BTP_SPLIT_END (1 << 5) /* rightmost page of split group */ #define BTP_HAS_GARBAGE (1 << 6) /* page has LP_DEAD tuples */ +#define BTP_INCOMPLETE_SPLIT (1 << 7) /* right sibling's downlink is missing */ /* - * The max allowed value of a cycle ID is a bit less than 64K. This is + * The max allowed value of a cycle ID is a bit less than 64K. This is * for convenience of pg_filedump and similar utilities: we want to use * the last 2 bytes of special space as an index type indicator, and * restricting cycle ID lets btree use that space for vacuum cycle IDs @@ -178,6 +179,7 @@ typedef struct BTMetaPageData #define P_ISHALFDEAD(opaque) ((opaque)->btpo_flags & BTP_HALF_DEAD) #define P_IGNORE(opaque) ((opaque)->btpo_flags & (BTP_DELETED|BTP_HALF_DEAD)) #define P_HAS_GARBAGE(opaque) ((opaque)->btpo_flags & BTP_HAS_GARBAGE) +#define P_INCOMPLETE_SPLIT(opaque) ((opaque)->btpo_flags & BTP_INCOMPLETE_SPLIT) /* * Lehman and Yao's algorithm requires a ``high key'' on every non-rightmost @@ -215,11 +217,10 @@ typedef struct BTMetaPageData #define XLOG_BTREE_SPLIT_L_ROOT 0x50 /* add tuple with split of root */ #define XLOG_BTREE_SPLIT_R_ROOT 0x60 /* as above, new item on right */ #define XLOG_BTREE_DELETE 0x70 /* delete leaf index tuples for a page */ -#define XLOG_BTREE_DELETE_PAGE 0x80 /* delete an entire page */ -#define XLOG_BTREE_DELETE_PAGE_META 0x90 /* same, and update metapage */ +#define XLOG_BTREE_UNLINK_PAGE 0x80 /* delete a half-dead page */ +#define XLOG_BTREE_UNLINK_PAGE_META 0x90 /* same, and update metapage */ #define XLOG_BTREE_NEWROOT 0xA0 /* new root page */ -#define XLOG_BTREE_DELETE_PAGE_HALF 0xB0 /* page deletion that makes - * parent half-dead */ +#define XLOG_BTREE_MARK_PAGE_HALFDEAD 0xB0 /* mark a leaf as half-dead */ #define XLOG_BTREE_VACUUM 0xC0 /* delete entries on a page during * vacuum */ #define XLOG_BTREE_REUSE_PAGE 0xD0 /* old page is about to be reused from @@ -254,7 +255,7 @@ typedef struct xl_btree_metadata typedef struct xl_btree_insert { xl_btreetid target; /* inserted tuple id */ - /* BlockNumber downlink field FOLLOWS IF NOT XLOG_BTREE_INSERT_LEAF */ + /* BlockNumber finishes_split field FOLLOWS IF NOT XLOG_BTREE_INSERT_LEAF */ /* xl_btree_metadata FOLLOWS IF XLOG_BTREE_INSERT_META */ /* INDEX TUPLE FOLLOWS AT END OF STRUCT */ } xl_btree_insert; @@ -272,9 +273,9 @@ typedef struct xl_btree_insert * Note: the four XLOG_BTREE_SPLIT xl_info codes all use this data record. * The _L and _R variants indicate whether the inserted tuple went into the * left or right split page (and thus, whether newitemoff and the new item - * are stored or not). The _ROOT variants indicate that we are splitting + * are stored or not). The _ROOT variants indicate that we are splitting * the root page, and thus that a newroot record rather than an insert or - * split record should follow. Note that a split record never carries a + * split record should follow. Note that a split record never carries a * metapage update --- we'll do that in the parent-level update. */ typedef struct xl_btree_split @@ -287,19 +288,18 @@ typedef struct xl_btree_split OffsetNumber firstright; /* first item moved to right page */ /* - * If level > 0, BlockIdData downlink follows. (We use BlockIdData rather - * than BlockNumber for alignment reasons: SizeOfBtreeSplit is only 16-bit - * aligned.) + * In the _L variants, next are OffsetNumber newitemoff and the new item. + * (In the _R variants, the new item is one of the right page's tuples.) + * The new item, but not newitemoff, is suppressed if XLogInsert chooses + * to store the left page's whole page image. * * If level > 0, an IndexTuple representing the HIKEY of the left page * follows. We don't need this on leaf pages, because it's the same as - * the leftmost key in the new right page. Also, it's suppressed if + * the leftmost key in the new right page. Also, it's suppressed if * XLogInsert chooses to store the left page's whole page image. * - * In the _L variants, next are OffsetNumber newitemoff and the new item. - * (In the _R variants, the new item is one of the right page's tuples.) - * The new item, but not newitemoff, is suppressed if XLogInsert chooses - * to store the left page's whole page image. + * If level > 0, BlockNumber of the page whose incomplete-split flag this + * insertion clears. (not aligned) * * Last are the right page's tuples in the form used by _bt_restore_page. */ @@ -370,23 +370,51 @@ typedef struct xl_btree_vacuum #define SizeOfBtreeVacuum (offsetof(xl_btree_vacuum, lastBlockVacuumed) + sizeof(BlockNumber)) /* - * This is what we need to know about deletion of a btree page. The target - * identifies the tuple removed from the parent page (note that we remove - * this tuple's downlink and the *following* tuple's key). Note we do not - * store any content for the deleted page --- it is just rewritten as empty - * during recovery, apart from resetting the btpo.xact. + * This is what we need to know about marking an empty branch for deletion. + * The target identifies the tuple removed from the parent page (note that we + * remove this tuple's downlink and the *following* tuple's key). Note that + * the leaf page is empty, so we don't need to store its content --- it is + * just reinitialized during recovery using the rest of the fields. */ -typedef struct xl_btree_delete_page +typedef struct xl_btree_mark_page_halfdead { xl_btreetid target; /* deleted tuple id in parent page */ - BlockNumber deadblk; /* child block being deleted */ - BlockNumber leftblk; /* child block's left sibling, if any */ - BlockNumber rightblk; /* child block's right sibling */ + + /* information needed to recreate the leaf page: */ + BlockNumber leafblk; /* leaf block ultimately being deleted */ + BlockNumber leftblk; /* leaf block's left sibling, if any */ + BlockNumber rightblk; /* leaf block's right sibling */ + BlockNumber topparent; /* topmost internal page in the branch */ +} xl_btree_mark_page_halfdead; + +#define SizeOfBtreeMarkPageHalfDead (offsetof(xl_btree_mark_page_halfdead, topparent) + sizeof(BlockNumber)) + +/* + * This is what we need to know about deletion of a btree page. Note we do + * not store any content for the deleted page --- it is just rewritten as empty + * during recovery, apart from resetting the btpo.xact. + */ +typedef struct xl_btree_unlink_page +{ + RelFileNode node; + BlockNumber deadblk; /* target block being deleted */ + BlockNumber leftsib; /* target block's left sibling, if any */ + BlockNumber rightsib; /* target block's right sibling */ + + /* + * Information needed to recreate the leaf page, when target is an + * internal page. + */ + BlockNumber leafblk; + BlockNumber leafleftsib; + BlockNumber leafrightsib; + BlockNumber topparent; /* next child down in the branch */ + TransactionId btpo_xact; /* value of btpo.xact for use in recovery */ - /* xl_btree_metadata FOLLOWS IF XLOG_BTREE_DELETE_PAGE_META */ -} xl_btree_delete_page; + /* xl_btree_metadata FOLLOWS IF XLOG_BTREE_UNLINK_PAGE_META */ +} xl_btree_unlink_page; -#define SizeOfBtreeDeletePage (offsetof(xl_btree_delete_page, btpo_xact) + sizeof(TransactionId)) +#define SizeOfBtreeUnlinkPage (offsetof(xl_btree_unlink_page, btpo_xact) + sizeof(TransactionId)) /* * New root log record. There are zero tuples if this is to establish an @@ -418,12 +446,12 @@ typedef struct xl_btree_newroot /* * When a new operator class is declared, we require that the user * supply us with an amproc procedure (BTORDER_PROC) for determining - * whether, for two keys a and b, a < b, a = b, or a > b. This routine + * whether, for two keys a and b, a < b, a = b, or a > b. This routine * must return < 0, 0, > 0, respectively, in these three cases. (It must * not return INT_MIN, since we may negate the result before using it.) * * To facilitate accelerated sorting, an operator class may choose to - * offer a second procedure (BTSORTSUPPORT_PROC). For full details, see + * offer a second procedure (BTSORTSUPPORT_PROC). For full details, see * src/include/utils/sortsupport.h. */ @@ -462,7 +490,7 @@ typedef BTStackData *BTStack; * BTScanOpaqueData is the btree-private state needed for an indexscan. * This consists of preprocessed scan keys (see _bt_preprocess_keys() for * details of the preprocessing), information about the current location - * of the scan, and information about the marked location, if any. (We use + * of the scan, and information about the marked location, if any. (We use * BTScanPosData to represent the data needed for each of current and marked * locations.) In addition we can remember some known-killed index entries * that must be marked before we can move off the current page. @@ -470,9 +498,9 @@ typedef BTStackData *BTStack; * Index scans work a page at a time: we pin and read-lock the page, identify * all the matching items on the page and save them in BTScanPosData, then * release the read-lock while returning the items to the caller for - * processing. This approach minimizes lock/unlock traffic. Note that we + * processing. This approach minimizes lock/unlock traffic. Note that we * keep the pin on the index page until the caller is done with all the items - * (this is needed for VACUUM synchronization, see nbtree/README). When we + * (this is needed for VACUUM synchronization, see nbtree/README). When we * are ready to step to the next page, if the caller has told us any of the * items were killed, we re-lock the page to mark them killed, then unlock. * Finally we drop the pin and step to the next page in the appropriate @@ -535,6 +563,7 @@ typedef struct BTArrayKeyInfo { int scan_key; /* index of associated key in arrayKeyData */ int cur_elem; /* index of current element in elem_values */ + int mark_elem; /* index of marked element in elem_values */ int num_elems; /* number of elems in current array value */ Datum *elem_values; /* array of num_elems Datums */ } BTArrayKeyInfo; @@ -583,7 +612,7 @@ typedef BTScanOpaqueData *BTScanOpaque; /* * We use some private sk_flags bits in preprocessed scan keys. We're allowed - * to use bits 16-31 (see skey.h). The uppermost bits are copied from the + * to use bits 16-31 (see skey.h). The uppermost bits are copied from the * index's indoption[] array entry for the index attribute. */ #define SK_BT_REQFWD 0x00010000 /* required to continue forward scan */ @@ -616,8 +645,7 @@ extern Datum btoptions(PG_FUNCTION_ARGS); extern bool _bt_doinsert(Relation rel, IndexTuple itup, IndexUniqueCheck checkUnique, Relation heapRel); extern Buffer _bt_getstackbuf(Relation rel, BTStack stack, int access); -extern void _bt_insert_parent(Relation rel, Buffer buf, Buffer rbuf, - BTStack stack, bool is_root, bool is_only); +extern void _bt_finish_split(Relation rel, Buffer bbuf, BTStack stack); /* * prototypes for functions in nbtpage.c @@ -625,6 +653,7 @@ extern void _bt_insert_parent(Relation rel, Buffer buf, Buffer rbuf, extern void _bt_initmetapage(Page page, BlockNumber rootbknum, uint32 level); extern Buffer _bt_getroot(Relation rel, int access); extern Buffer _bt_gettrueroot(Relation rel); +extern int _bt_getrootheight(Relation rel); extern void _bt_checkpage(Relation rel, Buffer buf); extern Buffer _bt_getbuf(Relation rel, BlockNumber blkno, int access); extern Buffer _bt_relandgetbuf(Relation rel, Buffer obuf, @@ -637,7 +666,7 @@ extern void _bt_delitems_delete(Relation rel, Buffer buf, extern void _bt_delitems_vacuum(Relation rel, Buffer buf, OffsetNumber *itemnos, int nitems, BlockNumber lastBlockVacuumed); -extern int _bt_pagedel(Relation rel, Buffer buf, BTStack stack); +extern int _bt_pagedel(Relation rel, Buffer buf); /* * prototypes for functions in nbtsearch.c @@ -646,7 +675,8 @@ extern BTStack _bt_search(Relation rel, int keysz, ScanKey scankey, bool nextkey, Buffer *bufP, int access); extern Buffer _bt_moveright(Relation rel, Buffer buf, int keysz, - ScanKey scankey, bool nextkey, int access); + ScanKey scankey, bool nextkey, bool forupdate, BTStack stack, + int access); extern OffsetNumber _bt_binsrch(Relation rel, Buffer buf, int keysz, ScanKey scankey, bool nextkey); extern int32 _bt_compare(Relation rel, int keysz, ScanKey scankey, @@ -665,6 +695,8 @@ extern void _bt_freestack(BTStack stack); extern void _bt_preprocess_array_keys(IndexScanDesc scan); extern void _bt_start_array_keys(IndexScanDesc scan, ScanDirection dir); extern bool _bt_advance_array_keys(IndexScanDesc scan, ScanDirection dir); +extern void _bt_mark_array_keys(IndexScanDesc scan); +extern void _bt_restore_array_keys(IndexScanDesc scan); extern void _bt_preprocess_keys(IndexScanDesc scan); extern IndexTuple _bt_checkkeys(IndexScanDesc scan, Page page, OffsetNumber offnum, @@ -682,7 +714,8 @@ extern void BTreeShmemInit(void); */ typedef struct BTSpool BTSpool; /* opaque type known only within nbtsort.c */ -extern BTSpool *_bt_spoolinit(Relation index, bool isunique, bool isdead); +extern BTSpool *_bt_spoolinit(Relation heap, Relation index, + bool isunique, bool isdead); extern void _bt_spooldestroy(BTSpool *btspool); extern void _bt_spool(IndexTuple itup, BTSpool *btspool); extern void _bt_leafbuild(BTSpool *btspool, BTSpool *spool2); @@ -692,8 +725,5 @@ extern void _bt_leafbuild(BTSpool *btspool, BTSpool *spool2); */ extern void btree_redo(XLogRecPtr lsn, XLogRecord *record); extern void btree_desc(StringInfo buf, uint8 xl_info, char *rec); -extern void btree_xlog_startup(void); -extern void btree_xlog_cleanup(void); -extern bool btree_safe_restartpoint(void); #endif /* NBTREE_H */ diff --git a/src/include/access/printtup.h b/src/include/access/printtup.h index acc58a8ec8..dc28789173 100644 --- a/src/include/access/printtup.h +++ b/src/include/access/printtup.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/printtup.h diff --git a/src/include/access/reloptions.h b/src/include/access/reloptions.h index 42af4a9bbc..81ff3286cf 100644 --- a/src/include/access/reloptions.h +++ b/src/include/access/reloptions.h @@ -9,7 +9,7 @@ * into a lot of low-level code. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/reloptions.h @@ -20,6 +20,7 @@ #define RELOPTIONS_H #include "access/htup.h" +#include "access/tupdesc.h" #include "nodes/pg_list.h" /* types supported by reloptions */ @@ -196,7 +197,7 @@ typedef struct * "base" is a pointer to the reloptions structure, and "offset" is an integer * variable that must be initialized to sizeof(reloptions structure). This * struct must have been allocated with enough space to hold any string option - * present, including terminating \0 for every option. SET_VARSIZE() must be + * present, including terminating \0 for every option. SET_VARSIZE() must be * called on the struct with this offset as the second argument, after all the * string options have been processed. */ diff --git a/src/include/access/relscan.h b/src/include/access/relscan.h index 2e967e1d59..8a57698feb 100644 --- a/src/include/access/relscan.h +++ b/src/include/access/relscan.h @@ -4,7 +4,7 @@ * POSTGRES relation scan descriptor definitions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/relscan.h @@ -16,6 +16,7 @@ #include "access/genam.h" #include "access/heapam.h" +#include "access/htup_details.h" #include "access/itup.h" #include "access/tupdesc.h" @@ -31,6 +32,7 @@ typedef struct HeapScanDescData bool rs_pageatatime; /* verify visibility page-at-a-time? */ bool rs_allow_strat; /* allow or disallow use of access strategy */ bool rs_allow_sync; /* allow or disallow use of syncscan */ + bool rs_temp_snap; /* unregister snapshot at scan end? */ /* state set up at initscan time */ BlockNumber rs_nblocks; /* number of blocks to scan */ @@ -100,6 +102,7 @@ typedef struct SysScanDescData Relation irel; /* NULL if doing heap scan */ HeapScanDesc scan; /* only valid in heap-scan case */ IndexScanDesc iscan; /* only valid in index-scan case */ + Snapshot snapshot; /* snapshot to unregister at end of scan */ } SysScanDescData; #endif /* RELSCAN_H */ diff --git a/src/include/access/rewriteheap.h b/src/include/access/rewriteheap.h index 1f6da613d6..4051c83852 100644 --- a/src/include/access/rewriteheap.h +++ b/src/include/access/rewriteheap.h @@ -3,7 +3,7 @@ * rewriteheap.h * Declarations for heap rewrite support functions * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994-5, Regents of the University of California * * src/include/access/rewriteheap.h @@ -14,17 +14,44 @@ #define REWRITE_HEAP_H #include "access/htup.h" +#include "storage/itemptr.h" +#include "storage/relfilenode.h" #include "utils/relcache.h" /* struct definition is private to rewriteheap.c */ typedef struct RewriteStateData *RewriteState; -extern RewriteState begin_heap_rewrite(Relation NewHeap, +extern RewriteState begin_heap_rewrite(Relation OldHeap, Relation NewHeap, TransactionId OldestXmin, TransactionId FreezeXid, - bool use_wal); + MultiXactId MultiXactCutoff, bool use_wal); extern void end_heap_rewrite(RewriteState state); extern void rewrite_heap_tuple(RewriteState state, HeapTuple oldTuple, HeapTuple newTuple); extern bool rewrite_heap_dead_tuple(RewriteState state, HeapTuple oldTuple); +/* + * On-Disk data format for an individual logical rewrite mapping. + */ +typedef struct LogicalRewriteMappingData +{ + RelFileNode old_node; + RelFileNode new_node; + ItemPointerData old_tid; + ItemPointerData new_tid; +} LogicalRewriteMappingData; + +/* --- + * The filename consists out of the following, dash separated, + * components: + * 1) database oid or InvalidOid for shared relations + * 2) the oid of the relation + * 3) xid we are mapping for + * 4) upper 32bit of the LSN at which a rewrite started + * 5) lower 32bit of the LSN at which a rewrite started + * 6) xid of the xact performing the mapping + * --- + */ +#define LOGICAL_REWRITE_FORMAT "map-%x-%x-%X_%X-%x-%x" +void CheckPointLogicalRewriteHeap(void); + #endif /* REWRITE_HEAP_H */ diff --git a/src/include/access/rmgr.h b/src/include/access/rmgr.h index 02c50e4dfd..1b577a2050 100644 --- a/src/include/access/rmgr.h +++ b/src/include/access/rmgr.h @@ -13,31 +13,23 @@ typedef uint8 RmgrId; /* * Built-in resource managers * - * Note: RM_MAX_ID could be as much as 255 without breaking the XLOG file - * format, but we keep it small to minimize the size of RmgrTable[]. + * The actual numerical values for each rmgr ID are defined by the order + * of entries in rmgrlist.h. + * + * Note: RM_MAX_ID must fit in RmgrId; widening that type will affect the XLOG + * file format. */ -#define RM_XLOG_ID 0 -#define RM_XACT_ID 1 -#define RM_SMGR_ID 2 -#define RM_CLOG_ID 3 -#define RM_DBASE_ID 4 -#define RM_TBLSPC_ID 5 -#define RM_MULTIXACT_ID 6 -#define RM_RELMAP_ID 7 -#define RM_STANDBY_ID 8 -#define RM_HEAP2_ID 9 -#define RM_HEAP_ID 10 -#define RM_BTREE_ID 11 -#define RM_HASH_ID 12 -#define RM_GIN_ID 13 -#define RM_GIST_ID 14 -#define RM_SEQ_ID 15 -#define RM_SPGIST_ID 16 -#ifdef PGXC -#define RM_BARRIER_ID 17 -#define RM_MAX_ID RM_BARRIER_ID -#else -#define RM_MAX_ID RM_SPGIST_ID -#endif +#define PG_RMGR(symname,name,redo,desc,startup,cleanup) \ + symname, + +typedef enum RmgrIds +{ +#include "access/rmgrlist.h" + RM_NEXT_ID +} RmgrIds; + +#undef PG_RMGR + +#define RM_MAX_ID (RM_NEXT_ID - 1) #endif /* RMGR_H */ diff --git a/src/include/access/rmgrlist.h b/src/include/access/rmgrlist.h new file mode 100644 index 0000000000..f6acd6d68c --- /dev/null +++ b/src/include/access/rmgrlist.h @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------- + * rmgrlist.h + * + * The resource manager list is kept in its own source file for possible + * use by automatic tools. The exact representation of a rmgr is determined + * by the PG_RMGR macro, which is not defined in this file; it can be + * defined by the caller for special purposes. + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/rmgrlist.h + *--------------------------------------------------------------------------- + */ + +/* there is deliberately not an #ifndef RMGRLIST_H here */ + +/* + * List of resource manager entries. Note that order of entries defines the + * numerical values of each rmgr's ID, which is stored in WAL records. New + * entries should be added at the end, to avoid changing IDs of existing + * entries. + * + * Changes to this list possibly need a XLOG_PAGE_MAGIC bump. + */ + +/* symbol name, textual name, redo, desc, startup, cleanup */ +PG_RMGR(RM_XLOG_ID, "XLOG", xlog_redo, xlog_desc, NULL, NULL) +PG_RMGR(RM_XACT_ID, "Transaction", xact_redo, xact_desc, NULL, NULL) +PG_RMGR(RM_SMGR_ID, "Storage", smgr_redo, smgr_desc, NULL, NULL) +PG_RMGR(RM_CLOG_ID, "CLOG", clog_redo, clog_desc, NULL, NULL) +PG_RMGR(RM_DBASE_ID, "Database", dbase_redo, dbase_desc, NULL, NULL) +PG_RMGR(RM_TBLSPC_ID, "Tablespace", tblspc_redo, tblspc_desc, NULL, NULL) +PG_RMGR(RM_MULTIXACT_ID, "MultiXact", multixact_redo, multixact_desc, NULL, NULL) +PG_RMGR(RM_RELMAP_ID, "RelMap", relmap_redo, relmap_desc, NULL, NULL) +PG_RMGR(RM_STANDBY_ID, "Standby", standby_redo, standby_desc, NULL, NULL) +PG_RMGR(RM_HEAP2_ID, "Heap2", heap2_redo, heap2_desc, NULL, NULL) +PG_RMGR(RM_HEAP_ID, "Heap", heap_redo, heap_desc, NULL, NULL) +PG_RMGR(RM_BTREE_ID, "Btree", btree_redo, btree_desc, NULL, NULL) +PG_RMGR(RM_HASH_ID, "Hash", hash_redo, hash_desc, NULL, NULL) +PG_RMGR(RM_GIN_ID, "Gin", gin_redo, gin_desc, gin_xlog_startup, gin_xlog_cleanup) +PG_RMGR(RM_GIST_ID, "Gist", gist_redo, gist_desc, gist_xlog_startup, gist_xlog_cleanup) +PG_RMGR(RM_SEQ_ID, "Sequence", seq_redo, seq_desc, NULL, NULL) +PG_RMGR(RM_SPGIST_ID, "SPGist", spg_redo, spg_desc, spg_xlog_startup, spg_xlog_cleanup) +#ifdef PGXC +PG_RMGR(RM_BARRIER_ID, "Barrier", barrier_redo, barrier_desc, NULL, NULL) +#endif diff --git a/src/include/access/sdir.h b/src/include/access/sdir.h index d81da29145..ffc3142118 100644 --- a/src/include/access/sdir.h +++ b/src/include/access/sdir.h @@ -4,7 +4,7 @@ * POSTGRES scan direction definitions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/sdir.h diff --git a/src/include/access/skey.h b/src/include/access/skey.h index d8c978fbaa..bb96808719 100644 --- a/src/include/access/skey.h +++ b/src/include/access/skey.h @@ -4,7 +4,7 @@ * POSTGRES scan key definitions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/skey.h @@ -42,7 +42,7 @@ typedef uint16 StrategyNumber; /* * A ScanKey represents the application of a comparison operator between - * a table or index column and a constant. When it's part of an array of + * a table or index column and a constant. When it's part of an array of * ScanKeys, the comparison conditions are implicitly ANDed. The index * column is the left argument of the operator, if it's a binary operator. * (The data structure can support unary indexable operators too; in that @@ -115,7 +115,7 @@ typedef ScanKeyData *ScanKey; * must be sorted according to the leading column number. * * The subsidiary ScanKey array appears in logical column order of the row - * comparison, which may be different from index column order. The array + * comparison, which may be different from index column order. The array * elements are like a normal ScanKey array except that: * sk_flags must include SK_ROW_MEMBER, plus SK_ROW_END in the last * element (needed since row header does not include a count) diff --git a/src/include/access/slru.h b/src/include/access/slru.h index 711601ae62..8eb22a4973 100644 --- a/src/include/access/slru.h +++ b/src/include/access/slru.h @@ -3,7 +3,7 @@ * slru.h * Simple LRU buffering for transaction status logfiles * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/slru.h @@ -31,7 +31,7 @@ * segment and page numbers in SimpleLruTruncate (see PagePrecedes()). * * Note: slru.c currently assumes that segment file names will be four hex - * digits. This sets a lower bound on the segment size (64K transactions + * digits. This sets a lower bound on the segment size (64K transactions * for 32-bit TransactionIds). */ #define SLRU_PAGES_PER_SEGMENT 32 @@ -55,7 +55,7 @@ typedef enum */ typedef struct SlruSharedData { - LWLockId ControlLock; + LWLock *ControlLock; /* Number of buffers managed by this SLRU structure */ int num_slots; @@ -69,7 +69,7 @@ typedef struct SlruSharedData bool *page_dirty; int *page_number; int *page_lru_count; - LWLockId *buffer_locks; + LWLock **buffer_locks; /* * Optional array of WAL flush LSNs associated with entries in the SLRU @@ -136,7 +136,7 @@ typedef SlruCtlData *SlruCtl; extern Size SimpleLruShmemSize(int nslots, int nlsns); extern void SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns, - LWLockId ctllock, const char *subdir); + LWLock *ctllock, const char *subdir); extern int SimpleLruZeroPage(SlruCtl ctl, int pageno); extern int SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok, TransactionId xid); @@ -145,10 +145,12 @@ extern int SimpleLruReadPage_ReadOnly(SlruCtl ctl, int pageno, extern void SimpleLruWritePage(SlruCtl ctl, int slotno); extern void SimpleLruFlush(SlruCtl ctl, bool checkpoint); extern void SimpleLruTruncate(SlruCtl ctl, int cutoffPage); +extern bool SimpleLruDoesPhysicalPageExist(SlruCtl ctl, int pageno); typedef bool (*SlruScanCallback) (SlruCtl ctl, char *filename, int segpage, void *data); extern bool SlruScanDirectory(SlruCtl ctl, SlruScanCallback callback, void *data); +extern void SlruDeleteSegment(SlruCtl ctl, char *filename); /* SlruScanDirectory public callbacks */ extern bool SlruScanDirCbReportPresence(SlruCtl ctl, char *filename, diff --git a/src/include/access/spgist.h b/src/include/access/spgist.h index 50cac280a5..9187b4ac41 100644 --- a/src/include/access/spgist.h +++ b/src/include/access/spgist.h @@ -4,7 +4,7 @@ * Public header file for SP-GiST access method. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/spgist.h diff --git a/src/include/access/spgist_private.h b/src/include/access/spgist_private.h index 74267a4390..d092029d8a 100644 --- a/src/include/access/spgist_private.h +++ b/src/include/access/spgist_private.h @@ -4,7 +4,7 @@ * Private declarations for SP-GiST access method. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/spgist_private.h @@ -17,7 +17,8 @@ #include "access/itup.h" #include "access/spgist.h" #include "nodes/tidbitmap.h" -#include "utils/rel.h" +#include "storage/relfilenode.h" +#include "utils/relcache.h" /* Page numbers of fixed-location pages */ @@ -184,7 +185,7 @@ typedef struct SpGistCache /* - * SPGiST tuple types. Note: inner, leaf, and dead tuple structs + * SPGiST tuple types. Note: inner, leaf, and dead tuple structs * must have the same tupstate field in the same position! Real inner and * leaf tuples always have tupstate = LIVE; if the state is something else, * use the SpGistDeadTuple struct to inspect the tuple. @@ -421,10 +422,7 @@ typedef struct spgxlogAddLeaf OffsetNumber offnumParent; uint16 nodeI; - /* - * new leaf tuple follows, on an intalign boundary (replay only needs to - * fetch its size field, so that should be enough alignment) - */ + /* new leaf tuple follows (unaligned!) */ } spgxlogAddLeaf; typedef struct spgxlogMoveLeafs @@ -448,9 +446,7 @@ typedef struct spgxlogMoveLeafs * data follows: * array of deleted tuple numbers, length nMoves * array of inserted tuple numbers, length nMoves + 1 or 1 - * list of leaf tuples, length nMoves + 1 or 1 (must be maxaligned) - * the tuple number arrays are padded to maxalign boundaries so that the - * leaf tuples will be suitably aligned + * list of leaf tuples, length nMoves + 1 or 1 (unaligned!) * * Note: if replaceDead is true then there is only one inserted tuple * number and only one leaf tuple in the data, because we are not copying @@ -462,8 +458,11 @@ typedef struct spgxlogMoveLeafs * Parent page *---------- */ + OffsetNumber offsets[1]; } spgxlogMoveLeafs; +#define SizeOfSpgxlogMoveLeafs offsetof(spgxlogMoveLeafs, offsets) + typedef struct spgxlogAddNode { RelFileNode node; @@ -482,8 +481,7 @@ typedef struct spgxlogAddNode spgxlogState stateSrc; /* - * updated inner tuple follows, on an intalign boundary (replay only needs - * to fetch its size field, so that should be enough alignment) + * updated inner tuple follows (unaligned!) */ } spgxlogAddNode; @@ -499,9 +497,8 @@ typedef struct spgxlogSplitTuple bool newPage; /* need to init that page? */ /* - * new prefix inner tuple follows, then new postfix inner tuple, on - * intalign boundaries (replay only needs to fetch size fields, so that - * should be enough alignment) + * new prefix inner tuple follows, then new postfix inner tuple + * (both are unaligned!) */ } spgxlogSplitTuple; @@ -530,13 +527,11 @@ typedef struct spgxlogPickSplit /*---------- * data follows: - * new inner tuple (assumed to have a maxaligned length) * array of deleted tuple numbers, length nDelete * array of inserted tuple numbers, length nInsert * array of page selector bytes for inserted tuples, length nInsert - * list of leaf tuples, length nInsert (must be maxaligned) - * the tuple number and page selector arrays are padded to maxalign - * boundaries so that the leaf tuples will be suitably aligned + * new inner tuple (unaligned!) + * list of leaf tuples, length nInsert (unaligned!) * * Buffer references in the rdata array are: * Src page (only if not root and not being init'd) @@ -545,8 +540,11 @@ typedef struct spgxlogPickSplit * Parent page (if any; could be same as Inner) *---------- */ + OffsetNumber offsets[1]; } spgxlogPickSplit; +#define SizeOfSpgxlogPickSplit offsetof(spgxlogPickSplit, offsets) + typedef struct spgxlogVacuumLeaf { RelFileNode node; @@ -569,8 +567,11 @@ typedef struct spgxlogVacuumLeaf * tuple numbers to insert in nextOffset links *---------- */ + OffsetNumber offsets[1]; } spgxlogVacuumLeaf; +#define SizeOfSpgxlogVacuumLeaf offsetof(spgxlogVacuumLeaf, offsets) + typedef struct spgxlogVacuumRoot { /* vacuum a root page when it is also a leaf */ @@ -582,8 +583,11 @@ typedef struct spgxlogVacuumRoot spgxlogState stateSrc; /* offsets of tuples to delete follow */ + OffsetNumber offsets[1]; } spgxlogVacuumRoot; +#define SizeOfSpgxlogVacuumRoot offsetof(spgxlogVacuumRoot, offsets) + typedef struct spgxlogVacuumRedirect { RelFileNode node; @@ -591,10 +595,14 @@ typedef struct spgxlogVacuumRedirect BlockNumber blkno; /* block number to clean */ uint16 nToPlaceholder; /* number of redirects to make placeholders */ OffsetNumber firstPlaceholder; /* first placeholder tuple to remove */ + TransactionId newestRedirectXid; /* newest XID of removed redirects */ /* offsets of redirect tuples to make placeholders follow */ + OffsetNumber offsets[1]; } spgxlogVacuumRedirect; +#define SizeOfSpgxlogVacuumRedirect offsetof(spgxlogVacuumRedirect, offsets) + /* * The "flags" argument for SpGistGetBuffer should be either GBUF_LEAF to * get a leaf page, or GBUF_INNER_PARITY(blockNumber) to get an inner @@ -650,7 +658,7 @@ extern void spgPageIndexMultiDelete(SpGistState *state, Page page, OffsetNumber *itemnos, int nitems, int firststate, int reststate, BlockNumber blkno, OffsetNumber offnum); -extern void spgdoinsert(Relation index, SpGistState *state, +extern bool spgdoinsert(Relation index, SpGistState *state, ItemPointer heapPtr, Datum datum, bool isnull); #endif /* SPGIST_PRIVATE_H */ diff --git a/src/include/access/subtrans.h b/src/include/access/subtrans.h index 72e3470d2b..9eddfa05db 100644 --- a/src/include/access/subtrans.h +++ b/src/include/access/subtrans.h @@ -3,7 +3,7 @@ * * PostgreSQL subtransaction-log manager * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/subtrans.h diff --git a/src/include/access/sysattr.h b/src/include/access/sysattr.h index e4c507b839..8981c8f2c2 100644 --- a/src/include/access/sysattr.h +++ b/src/include/access/sysattr.h @@ -4,7 +4,7 @@ * POSTGRES system attribute definitions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/sysattr.h @@ -33,5 +33,4 @@ #endif - #endif /* SYSATTR_H */ diff --git a/src/include/access/timeline.h b/src/include/access/timeline.h new file mode 100644 index 0000000000..a5664688ea --- /dev/null +++ b/src/include/access/timeline.h @@ -0,0 +1,44 @@ +/* + * timeline.h + * + * Functions for reading and writing timeline history files. + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/timeline.h + */ +#ifndef TIMELINE_H +#define TIMELINE_H + +#include "access/xlogdefs.h" +#include "nodes/pg_list.h" + +/* + * A list of these structs describes the timeline history of the server. Each + * TimeLineHistoryEntry represents a piece of WAL belonging to the history, + * from newest to oldest. All WAL positions between 'begin' and 'end' belong to + * the timeline represented by the entry. Together the 'begin' and 'end' + * pointers of all the entries form a contiguous line from beginning of time + * to infinity. + */ +typedef struct +{ + TimeLineID tli; + XLogRecPtr begin; /* inclusive */ + XLogRecPtr end; /* exclusive, 0 means infinity */ +} TimeLineHistoryEntry; + +extern List *readTimeLineHistory(TimeLineID targetTLI); +extern bool existsTimeLineHistory(TimeLineID probeTLI); +extern TimeLineID findNewestTimeLine(TimeLineID startTLI); +extern void writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, + XLogRecPtr switchpoint, char *reason); +extern void writeTimeLineHistoryFile(TimeLineID tli, char *content, int size); +extern void restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end); +extern bool tliInHistory(TimeLineID tli, List *expectedTLIs); +extern TimeLineID tliOfPointInHistory(XLogRecPtr ptr, List *history); +extern XLogRecPtr tliSwitchPoint(TimeLineID tli, List *history, + TimeLineID *nextTLI); + +#endif /* TIMELINE_H */ diff --git a/src/include/access/transam.h b/src/include/access/transam.h index b9d46e3504..35b74ab5f2 100644 --- a/src/include/access/transam.h +++ b/src/include/access/transam.h @@ -9,7 +9,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 2010-2012 Postgres-XC Development Group * @@ -71,6 +71,11 @@ (AssertMacro(TransactionIdIsNormal(id1) && TransactionIdIsNormal(id2)), \ (int32) ((id1) - (id2)) < 0) +/* compare two XIDs already known to be normal; this is a macro for speed */ +#define NormalTransactionIdFollows(id1, id2) \ + (AssertMacro(TransactionIdIsNormal(id1) && TransactionIdIsNormal(id2)), \ + (int32) ((id1) - (id2)) > 0) + /* ---------- * Object ID (OID) zero is InvalidOid. * @@ -81,7 +86,7 @@ * using the OID generator. (We start the generator at 10000.) * * OIDs beginning at 16384 are assigned from the OID generator - * during normal multiuser operation. (We force the generator up to + * during normal multiuser operation. (We force the generator up to * 16384 as soon as we are in normal operation.) * * The choices of 10000 and 16384 are completely arbitrary, and can be moved @@ -147,10 +152,6 @@ extern bool TransactionStartedDuringRecovery(void); /* in transam/varsup.c */ extern PGDLLIMPORT VariableCache ShmemVariableCache; -/* in transam/transam.c */ -extern const XLogRecPtr InvalidXLogRecPtr; - - /* * prototypes for functions in transam/transam.c */ diff --git a/src/include/access/tupconvert.h b/src/include/access/tupconvert.h index 7511aa6405..dd4ba127c2 100644 --- a/src/include/access/tupconvert.h +++ b/src/include/access/tupconvert.h @@ -4,7 +4,7 @@ * Tuple conversion support. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/tupconvert.h @@ -15,6 +15,7 @@ #define TUPCONVERT_H #include "access/htup.h" +#include "access/tupdesc.h" typedef struct TupleConversionMap diff --git a/src/include/access/tupdesc.h b/src/include/access/tupdesc.h index 953e146d5e..083f4bdc40 100644 --- a/src/include/access/tupdesc.h +++ b/src/include/access/tupdesc.h @@ -4,7 +4,7 @@ * POSTGRES tuple descriptor definitions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/tupdesc.h @@ -55,7 +55,7 @@ typedef struct tupleConstr * TupleDesc; with the exception that tdhasoid indicates if OID is present. * * If the tupdesc is known to correspond to a named rowtype (such as a table's - * rowtype) then tdtypeid identifies that type and tdtypmod is -1. Otherwise + * rowtype) then tdtypeid identifies that type and tdtypmod is -1. Otherwise * tdtypeid is RECORDOID, and tdtypmod can be either -1 for a fully anonymous * row type, or a value >= 0 to allow the rowtype to be looked up in the * typcache.c type cache. @@ -90,6 +90,9 @@ extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc); extern TupleDesc CreateTupleDescCopyConstr(TupleDesc tupdesc); +extern void TupleDescCopyEntry(TupleDesc dst, AttrNumber dstAttno, + TupleDesc src, AttrNumber srcAttno); + extern void FreeTupleDesc(TupleDesc tupdesc); extern void IncrTupleDescRefCount(TupleDesc tupdesc); diff --git a/src/include/access/tupmacs.h b/src/include/access/tupmacs.h index 984a049297..ff198fe75e 100644 --- a/src/include/access/tupmacs.h +++ b/src/include/access/tupmacs.h @@ -4,7 +4,7 @@ * Tuple macros used by both index tuples and heap tuples. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/tupmacs.h @@ -92,7 +92,7 @@ /* * att_align_datum aligns the given offset as needed for a datum of alignment - * requirement attalign and typlen attlen. attdatum is the Datum variable + * requirement attalign and typlen attlen. attdatum is the Datum variable * we intend to pack into a tuple (it's only accessed if we are dealing with * a varlena type). Note that this assumes the Datum will be stored as-is; * callers that are intending to convert non-short varlena datums to short @@ -101,7 +101,7 @@ #define att_align_datum(cur_offset, attalign, attlen, attdatum) \ ( \ ((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? \ - (intptr_t) (cur_offset) : \ + (uintptr_t) (cur_offset) : \ att_align_nominal(cur_offset, attalign) \ ) @@ -111,18 +111,18 @@ * pointer; when accessing a varlena field we have to "peek" to see if we * are looking at a pad byte or the first byte of a 1-byte-header datum. * (A zero byte must be either a pad byte, or the first byte of a correctly - * aligned 4-byte length word; in either case we can align safely. A non-zero + * aligned 4-byte length word; in either case we can align safely. A non-zero * byte must be either a 1-byte length word, or the first byte of a correctly * aligned 4-byte length word; in either case we need not align.) * * Note: some callers pass a "char *" pointer for cur_offset. This is - * a bit of a hack but should work all right as long as intptr_t is the + * a bit of a hack but should work all right as long as uintptr_t is the * correct width. */ #define att_align_pointer(cur_offset, attalign, attlen, attptr) \ ( \ ((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? \ - (intptr_t) (cur_offset) : \ + (uintptr_t) (cur_offset) : \ att_align_nominal(cur_offset, attalign) \ ) @@ -144,7 +144,7 @@ #define att_align_nominal(cur_offset, attalign) \ ( \ ((attalign) == 'i') ? INTALIGN(cur_offset) : \ - (((attalign) == 'c') ? (intptr_t) (cur_offset) : \ + (((attalign) == 'c') ? (uintptr_t) (cur_offset) : \ (((attalign) == 'd') ? DOUBLEALIGN(cur_offset) : \ ( \ AssertMacro((attalign) == 's'), \ diff --git a/src/include/access/tuptoaster.h b/src/include/access/tuptoaster.h index e3dbde0def..d8edd9e987 100644 --- a/src/include/access/tuptoaster.h +++ b/src/include/access/tuptoaster.h @@ -4,7 +4,7 @@ * POSTGRES definitions for external and compressed storage * of variable size attributes. * - * Copyright (c) 2000-2012, PostgreSQL Global Development Group + * Copyright (c) 2000-2014, PostgreSQL Global Development Group * * src/include/access/tuptoaster.h * @@ -13,8 +13,9 @@ #ifndef TUPTOASTER_H #define TUPTOASTER_H -#include "access/htup.h" +#include "access/htup_details.h" #include "utils/relcache.h" +#include "storage/lock.h" /* * This enables de-toasting of index entries. Needed until VACUUM is @@ -59,7 +60,7 @@ * The code will also consider moving MAIN data out-of-line, but only as a * last resort if the previous steps haven't reached the target tuple size. * In this phase we use a different target size, currently equal to the - * largest tuple that will fit on a heap page. This is reasonable since + * largest tuple that will fit on a heap page. This is reasonable since * the user has told us to keep the data in-line if at all possible. */ #define TOAST_TUPLES_PER_PAGE_MAIN 1 @@ -75,7 +76,7 @@ /* * When we store an oversize datum externally, we divide it into chunks - * containing at most TOAST_MAX_CHUNK_SIZE data bytes. This number *must* + * containing at most TOAST_MAX_CHUNK_SIZE data bytes. This number *must* * be small enough that the completed toast-table tuple (including the * ID and sequence fields and all overhead) will fit on a page. * The coding here sets the size on the theory that we want to fit @@ -94,6 +95,36 @@ sizeof(int32) - \ VARHDRSZ) +/* Size of an EXTERNAL datum that contains a standard TOAST pointer */ +#define TOAST_POINTER_SIZE (VARHDRSZ_EXTERNAL + sizeof(struct varatt_external)) + +/* Size of an indirect datum that contains a standard TOAST pointer */ +#define INDIRECT_POINTER_SIZE (VARHDRSZ_EXTERNAL + sizeof(struct varatt_indirect)) + +/* + * Testing whether an externally-stored value is compressed now requires + * comparing extsize (the actual length of the external data) to rawsize + * (the original uncompressed datum's size). The latter includes VARHDRSZ + * overhead, the former doesn't. We never use compression unless it actually + * saves space, so we expect either equality or less-than. + */ +#define VARATT_EXTERNAL_IS_COMPRESSED(toast_pointer) \ + ((toast_pointer).va_extsize < (toast_pointer).va_rawsize - VARHDRSZ) + +/* + * Macro to fetch the possibly-unaligned contents of an EXTERNAL datum + * into a local "struct varatt_external" toast pointer. This should be + * just a memcpy, but some versions of gcc seem to produce broken code + * that assumes the datum contents are aligned. Introducing an explicit + * intermediate "varattrib_1b_e *" variable seems to fix it. + */ +#define VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr) \ +do { \ + varattrib_1b_e *attre = (varattrib_1b_e *) (attr); \ + Assert(VARATT_IS_EXTERNAL(attre)); \ + Assert(VARSIZE_EXTERNAL(attre) == sizeof(toast_pointer) + VARHDRSZ_EXTERNAL); \ + memcpy(&(toast_pointer), VARDATA_EXTERNAL(attre), sizeof(toast_pointer)); \ +} while (0) /* ---------- * toast_insert_or_update - @@ -153,16 +184,14 @@ extern struct varlena *heap_tuple_untoast_attr_slice(struct varlena * attr, extern HeapTuple toast_flatten_tuple(HeapTuple tup, TupleDesc tupleDesc); /* ---------- - * toast_flatten_tuple_attribute - + * toast_flatten_tuple_to_datum - * - * If a Datum is of composite type, "flatten" it to contain no toasted fields. - * This must be invoked on any potentially-composite field that is to be - * inserted into a tuple. Doing this preserves the invariant that toasting - * goes only one level deep in a tuple. + * "Flatten" a tuple containing out-of-line toasted fields into a Datum. * ---------- */ -extern Datum toast_flatten_tuple_attribute(Datum value, - Oid typeId, int32 typeMod); +extern Datum toast_flatten_tuple_to_datum(HeapTupleHeader tup, + uint32 tup_len, + TupleDesc tupleDesc); /* ---------- * toast_compress_datum - @@ -188,4 +217,12 @@ extern Size toast_raw_datum_size(Datum value); */ extern Size toast_datum_size(Datum value); +/* ---------- + * toast_get_valid_index - + * + * Return OID of valid index associated to a toast relation + * ---------- + */ +extern Oid toast_get_valid_index(Oid toastoid, LOCKMODE lock); + #endif /* TUPTOASTER_H */ diff --git a/src/include/access/twophase.h b/src/include/access/twophase.h index e01385407f..df1b6e334b 100644 --- a/src/include/access/twophase.h +++ b/src/include/access/twophase.h @@ -4,7 +4,7 @@ * Two-phase-commit related declarations. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/twophase.h @@ -14,7 +14,9 @@ #ifndef TWOPHASE_H #define TWOPHASE_H -#include "storage/proc.h" +#include "access/xlogdefs.h" +#include "datatype/timestamp.h" +#include "storage/lock.h" /* * GlobalTransactionData is defined in twophase.c; other places have no @@ -28,6 +30,9 @@ extern int max_prepared_xacts; extern Size TwoPhaseShmemSize(void); extern void TwoPhaseShmemInit(void); +extern void AtAbort_Twophase(void); +extern void PostPrepare_Twophase(void); + extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid); extern BackendId TwoPhaseGetDummyBackendId(TransactionId xid); diff --git a/src/include/access/twophase_rmgr.h b/src/include/access/twophase_rmgr.h index aed8ba3bac..2b0c521062 100644 --- a/src/include/access/twophase_rmgr.h +++ b/src/include/access/twophase_rmgr.h @@ -4,7 +4,7 @@ * Two-phase-commit resource managers definition * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/twophase_rmgr.h diff --git a/src/include/access/valid.h b/src/include/access/valid.h index ce970e44df..7a83395492 100644 --- a/src/include/access/valid.h +++ b/src/include/access/valid.h @@ -4,7 +4,7 @@ * POSTGRES tuple qualification validity definitions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/valid.h diff --git a/src/include/access/visibilitymap.h b/src/include/access/visibilitymap.h index 5774e92e15..888705e087 100644 --- a/src/include/access/visibilitymap.h +++ b/src/include/access/visibilitymap.h @@ -4,7 +4,7 @@ * visibility map interface * * - * Portions Copyright (c) 2007-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 2007-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/visibilitymap.h @@ -24,8 +24,8 @@ extern void visibilitymap_clear(Relation rel, BlockNumber heapBlk, extern void visibilitymap_pin(Relation rel, BlockNumber heapBlk, Buffer *vmbuf); extern bool visibilitymap_pin_ok(BlockNumber heapBlk, Buffer vmbuf); -extern void visibilitymap_set(Relation rel, BlockNumber heapBlk, - XLogRecPtr recptr, Buffer vmbuf, TransactionId cutoff_xid); +extern void visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf, + XLogRecPtr recptr, Buffer vmBuf, TransactionId cutoff_xid); extern bool visibilitymap_test(Relation rel, BlockNumber heapBlk, Buffer *vmbuf); extern BlockNumber visibilitymap_count(Relation rel); extern void visibilitymap_truncate(Relation rel, BlockNumber nheapblocks); diff --git a/src/include/access/xact.h b/src/include/access/xact.h index 127a849c10..6492979e73 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -9,7 +9,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 2010-2012 Postgres-XC Development Group * @@ -37,7 +37,7 @@ #define XACT_SERIALIZABLE 3 extern int DefaultXactIsoLevel; -extern int XactIsoLevel; +extern PGDLLIMPORT int XactIsoLevel; /* * We implement three isolation levels internally. @@ -85,7 +85,9 @@ typedef enum { XACT_EVENT_COMMIT, XACT_EVENT_ABORT, - XACT_EVENT_PREPARE + XACT_EVENT_PREPARE, + XACT_EVENT_PRE_COMMIT, + XACT_EVENT_PRE_PREPARE } XactEvent; typedef void (*XactCallback) (XactEvent event, void *arg); @@ -94,7 +96,8 @@ typedef enum { SUBXACT_EVENT_START_SUB, SUBXACT_EVENT_COMMIT_SUB, - SUBXACT_EVENT_ABORT_SUB + SUBXACT_EVENT_ABORT_SUB, + SUBXACT_EVENT_PRE_COMMIT_SUB } SubXactEvent; typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid, @@ -244,6 +247,8 @@ extern void SetTopGlobalTransactionId(GlobalTransactionId gxid); #endif extern TransactionId GetStableLatestTransactionId(void); extern SubTransactionId GetCurrentSubTransactionId(void); +extern void MarkCurrentTransactionIdLoggedIfAny(void); +extern bool SubTransactionIsActive(SubTransactionId subxid); extern CommandId GetCurrentCommandId(bool used); extern TimestampTz GetCurrentTransactionStartTimestamp(void); extern TimestampTz GetCurrentStatementStartTimestamp(void); @@ -280,6 +285,7 @@ extern char TransactionBlockStatusCode(void); extern void AbortOutOfAnyTransaction(void); extern void PreventTransactionChain(bool isTopLevel, const char *stmtType); extern void RequireTransactionChain(bool isTopLevel, const char *stmtType); +extern void WarnNoTransactionChain(bool isTopLevel, const char *stmtType); extern bool IsInTransactionChain(bool isTopLevel); extern void RegisterXactCallback(XactCallback callback, void *arg); extern void UnregisterXactCallback(XactCallback callback, void *arg); diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 0a7fee91a2..7a8bce8b13 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -3,7 +3,7 @@ * * PostgreSQL transaction log manager * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/xlog.h @@ -31,24 +31,25 @@ * where there can be zero to four backup blocks (as signaled by xl_info flag * bits). XLogRecord structs always start on MAXALIGN boundaries in the WAL * files, and we round up SizeOfXLogRecord so that the rmgr data is also - * guaranteed to begin on a MAXALIGN boundary. However, no padding is added + * guaranteed to begin on a MAXALIGN boundary. However, no padding is added * to align BkpBlock structs or backup block data. * * NOTE: xl_len counts only the rmgr data, not the XLogRecord header, - * and also not any backup blocks. xl_tot_len counts everything. Neither + * and also not any backup blocks. xl_tot_len counts everything. Neither * length field is rounded up to an alignment boundary. */ typedef struct XLogRecord { - pg_crc32 xl_crc; /* CRC for this record */ - XLogRecPtr xl_prev; /* ptr to previous record in log */ - TransactionId xl_xid; /* xact id */ uint32 xl_tot_len; /* total len of entire record */ + TransactionId xl_xid; /* xact id */ uint32 xl_len; /* total len of rmgr data */ uint8 xl_info; /* flag bits, see below */ RmgrId xl_rmid; /* resource manager for this record */ + /* 2 bytes of padding here, initialize to zero */ + XLogRecPtr xl_prev; /* ptr to previous record in log */ + pg_crc32 xl_crc; /* CRC for this record */ - /* Depending on MAXALIGN, there are either 2 or 6 wasted bytes here */ + /* If MAXALIGN==8, there are 4 wasted bytes here */ /* ACTUAL LOG DATA FOLLOWS AT END OF STRUCT */ @@ -70,11 +71,7 @@ typedef struct XLogRecord */ #define XLR_BKP_BLOCK_MASK 0x0F /* all info bits used for bkp blocks */ #define XLR_MAX_BKP_BLOCKS 4 -#define XLR_SET_BKP_BLOCK(iblk) (0x08 >> (iblk)) -#define XLR_BKP_BLOCK_1 XLR_SET_BKP_BLOCK(0) /* 0x08 */ -#define XLR_BKP_BLOCK_2 XLR_SET_BKP_BLOCK(1) /* 0x04 */ -#define XLR_BKP_BLOCK_3 XLR_SET_BKP_BLOCK(2) /* 0x02 */ -#define XLR_BKP_BLOCK_4 XLR_SET_BKP_BLOCK(3) /* 0x01 */ +#define XLR_BKP_BLOCK(iblk) (0x08 >> (iblk)) /* iblk in 0..3 */ /* Sync methods */ #define SYNC_METHOD_FSYNC 0 @@ -93,17 +90,17 @@ extern int sync_method; * If buffer is valid then XLOG will check if buffer must be backed up * (ie, whether this is first change of that page since last checkpoint). * If so, the whole page contents are attached to the XLOG record, and XLOG - * sets XLR_BKP_BLOCK_X bit in xl_info. Note that the buffer must be pinned + * sets XLR_BKP_BLOCK(N) bit in xl_info. Note that the buffer must be pinned * and exclusive-locked by the caller, so that it won't change under us. * NB: when the buffer is backed up, we DO NOT insert the data pointed to by * this XLogRecData struct into the XLOG record, since we assume it's present * in the buffer. Therefore, rmgr redo routines MUST pay attention to - * XLR_BKP_BLOCK_X to know what is actually stored in the XLOG record. - * The i'th XLR_BKP_BLOCK bit corresponds to the i'th distinct buffer + * XLR_BKP_BLOCK(N) to know what is actually stored in the XLOG record. + * The N'th XLR_BKP_BLOCK bit corresponds to the N'th distinct buffer * value (ignoring InvalidBuffer) appearing in the rdata chain. * * When buffer is valid, caller must set buffer_std to indicate whether the - * page uses standard pd_lower/pd_upper header fields. If this is true, then + * page uses standard pd_lower/pd_upper header fields. If this is true, then * XLOG is allowed to omit the free space between pd_lower and pd_upper from * the backed-up page image. Note that even when buffer_std is false, the * page MUST have an LSN field as its first eight bytes! @@ -176,11 +173,11 @@ typedef enum RECOVERY_TARGET_UNSET, RECOVERY_TARGET_XID, RECOVERY_TARGET_TIME, - RECOVERY_TARGET_NAME + RECOVERY_TARGET_NAME, #ifdef PGXC - , - RECOVERY_TARGET_BARRIER + RECOVERY_TARGET_BARRIER, #endif + RECOVERY_TARGET_IMMEDIATE } RecoveryTargetType; extern XLogRecPtr XactLastRecEnd; @@ -196,14 +193,17 @@ extern bool XLogArchiveMode; extern char *XLogArchiveCommand; extern bool EnableHotStandby; extern bool fullPageWrites; +extern bool wal_log_hints; extern bool log_checkpoints; +extern int num_xloginsert_locks; /* WAL levels */ typedef enum WalLevel { WAL_LEVEL_MINIMAL = 0, WAL_LEVEL_ARCHIVE, - WAL_LEVEL_HOT_STANDBY + WAL_LEVEL_HOT_STANDBY, + WAL_LEVEL_LOGICAL } WalLevel; extern int wal_level; @@ -216,9 +216,23 @@ extern int wal_level; */ #define XLogIsNeeded() (wal_level >= WAL_LEVEL_ARCHIVE) -/* Do we need to WAL-log information required only for Hot Standby? */ +/* + * Is a full-page image needed for hint bit updates? + * + * Normally, we don't WAL-log hint bit updates, but if checksums are enabled, + * we have to protect them against torn page writes. When you only set + * individual bits on a page, it's still consistent no matter what combination + * of the bits make it to disk, but the checksum wouldn't match. Also WAL-log + * them if forced by wal_log_hints=on. + */ +#define XLogHintBitIsNeeded() (DataChecksumsEnabled() || wal_log_hints) + +/* Do we need to WAL-log information required only for Hot Standby and logical replication? */ #define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_HOT_STANDBY) +/* Do we need to WAL-log information required only for logical replication? */ +#define XLogLogicalInfoActive() (wal_level >= WAL_LEVEL_LOGICAL) + #ifdef WAL_DEBUG extern bool XLOG_DEBUG; #endif @@ -268,39 +282,47 @@ typedef struct CheckpointStatsData extern CheckpointStatsData CheckpointStats; extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info, XLogRecData *rdata); +extern bool XLogCheckBufferNeedsBackup(Buffer buffer); extern void XLogFlush(XLogRecPtr RecPtr); extern bool XLogBackgroundFlush(void); extern bool XLogNeedsFlush(XLogRecPtr RecPtr); -extern int XLogFileInit(uint32 log, uint32 seg, - bool *use_existent, bool use_lock); -extern int XLogFileOpen(uint32 log, uint32 seg); +extern int XLogFileInit(XLogSegNo segno, bool *use_existent, bool use_lock); +extern int XLogFileOpen(XLogSegNo segno); +extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std); -extern void XLogGetLastRemoved(uint32 *log, uint32 *seg); +extern void CheckXLogRemoved(XLogSegNo segno, TimeLineID tli); +extern XLogSegNo XLogGetLastRemovedSegno(void); extern void XLogSetAsyncXactLSN(XLogRecPtr record); +extern void XLogSetReplicationSlotMinimumLSN(XLogRecPtr lsn); -extern void RestoreBkpBlocks(XLogRecPtr lsn, XLogRecord *record, bool cleanup); +extern Buffer RestoreBackupBlock(XLogRecPtr lsn, XLogRecord *record, + int block_index, + bool get_cleanup_lock, bool keep_buffer); extern void xlog_redo(XLogRecPtr lsn, XLogRecord *record); extern void xlog_desc(StringInfo buf, uint8 xl_info, char *rec); -extern void issue_xlog_fsync(int fd, uint32 log, uint32 seg); +extern void issue_xlog_fsync(int fd, XLogSegNo segno); extern bool RecoveryInProgress(void); extern bool HotStandbyActive(void); +extern bool HotStandbyActiveInReplay(void); extern bool XLogInsertAllowed(void); extern void GetXLogReceiptTime(TimestampTz *rtime, bool *fromStream); -extern XLogRecPtr GetXLogReplayRecPtr(XLogRecPtr *restoreLastRecPtr); -extern XLogRecPtr GetStandbyFlushRecPtr(void); +extern XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI); extern XLogRecPtr GetXLogInsertRecPtr(void); extern XLogRecPtr GetXLogWriteRecPtr(void); extern bool RecoveryIsPaused(void); extern void SetRecoveryPause(bool recoveryPause); extern TimestampTz GetLatestXTime(void); extern TimestampTz GetCurrentChunkReplayStartTime(void); +extern char *XLogFileNameP(TimeLineID tli, XLogSegNo segno); extern void UpdateControlFile(void); extern uint64 GetSystemIdentifier(void); +extern bool DataChecksumsEnabled(void); +extern XLogRecPtr GetFakeLSNForUnloggedRel(void); extern Size XLOGShmemSize(void); extern void XLOGShmemInit(void); extern void BootStrapXLOG(void); @@ -316,7 +338,6 @@ extern XLogRecPtr GetRedoRecPtr(void); extern XLogRecPtr GetInsertRecPtr(void); extern XLogRecPtr GetFlushRecPtr(void); extern void GetNextXidAndEpoch(TransactionId *xid, uint32 *epoch); -extern TimeLineID GetRecoveryTargetTLI(void); extern bool CheckPromoteSignal(void); extern void WakeupRecovery(void); @@ -325,8 +346,10 @@ extern void SetWalWriterSleeping(bool sleeping); /* * Starting/stopping a base backup */ -extern XLogRecPtr do_pg_start_backup(const char *backupidstr, bool fast, char **labelfile); -extern XLogRecPtr do_pg_stop_backup(char *labelfile, bool waitforarchive); +extern XLogRecPtr do_pg_start_backup(const char *backupidstr, bool fast, + TimeLineID *starttli_p, char **labelfile); +extern XLogRecPtr do_pg_stop_backup(char *labelfile, bool waitforarchive, + TimeLineID *stoptli_p); extern void do_pg_abort_backup(void); /* File path names (all relative to $PGDATA) */ diff --git a/src/include/access/xlog_fn.h b/src/include/access/xlog_fn.h new file mode 100644 index 0000000000..b361db4f1f --- /dev/null +++ b/src/include/access/xlog_fn.h @@ -0,0 +1,35 @@ +/* + * xlog_fn.h + * + * PostgreSQL transaction log SQL-callable function declarations + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlog_fn.h + */ +#ifndef XLOG_FN_H +#define XLOG_FN_H + +#include "fmgr.h" + +extern Datum pg_start_backup(PG_FUNCTION_ARGS); +extern Datum pg_stop_backup(PG_FUNCTION_ARGS); +extern Datum pg_switch_xlog(PG_FUNCTION_ARGS); +extern Datum pg_create_restore_point(PG_FUNCTION_ARGS); +extern Datum pg_current_xlog_location(PG_FUNCTION_ARGS); +extern Datum pg_current_xlog_insert_location(PG_FUNCTION_ARGS); +extern Datum pg_last_xlog_receive_location(PG_FUNCTION_ARGS); +extern Datum pg_last_xlog_replay_location(PG_FUNCTION_ARGS); +extern Datum pg_last_xact_replay_timestamp(PG_FUNCTION_ARGS); +extern Datum pg_xlogfile_name_offset(PG_FUNCTION_ARGS); +extern Datum pg_xlogfile_name(PG_FUNCTION_ARGS); +extern Datum pg_is_in_recovery(PG_FUNCTION_ARGS); +extern Datum pg_xlog_replay_pause(PG_FUNCTION_ARGS); +extern Datum pg_xlog_replay_resume(PG_FUNCTION_ARGS); +extern Datum pg_is_xlog_replay_paused(PG_FUNCTION_ARGS); +extern Datum pg_xlog_location_diff(PG_FUNCTION_ARGS); +extern Datum pg_is_in_backup(PG_FUNCTION_ARGS); +extern Datum pg_backup_start_time(PG_FUNCTION_ARGS); + +#endif /* XLOG_FN_H */ diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h index 3328a50fab..3a692cdf0c 100644 --- a/src/include/access/xlog_internal.h +++ b/src/include/access/xlog_internal.h @@ -8,7 +8,10 @@ * needed by rmgr routines (redo support for individual record types). * So the XLogRecord typedef and associated stuff appear in xlog.h. * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Note: This file must be includable in both frontend and backend contexts, + * to allow stand-alone tools like pg_receivexlog to deal with WAL files. + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/xlog_internal.h @@ -16,8 +19,9 @@ #ifndef XLOG_INTERNAL_H #define XLOG_INTERNAL_H -#include "access/xlog.h" -#include "fmgr.h" +#include "access/xlogdefs.h" +#include "datatype/timestamp.h" +#include "lib/stringinfo.h" #include "pgtime.h" #include "storage/block.h" #include "storage/relfilenode.h" @@ -49,29 +53,9 @@ typedef struct BkpBlock } BkpBlock; /* - * When there is not enough space on current page for whole record, we - * continue on the next page with continuation record. (However, the - * XLogRecord header will never be split across pages; if there's less than - * SizeOfXLogRecord space left at the end of a page, we just waste it.) - * - * Note that xl_rem_len includes backup-block data; that is, it tracks - * xl_tot_len not xl_len in the initial header. Also note that the - * continuation data isn't necessarily aligned. - */ -typedef struct XLogContRecord -{ - uint32 xl_rem_len; /* total len of remaining data for record */ - - /* ACTUAL LOG DATA FOLLOWS AT END OF STRUCT */ - -} XLogContRecord; - -#define SizeOfXLogContRecord sizeof(XLogContRecord) - -/* * Each page of XLOG file has a header like this: */ -#define XLOG_PAGE_MAGIC 0xD071 /* can be used as WAL version indicator */ +#define XLOG_PAGE_MAGIC 0xD07E /* can be used as WAL version indicator */ typedef struct XLogPageHeaderData { @@ -79,6 +63,17 @@ typedef struct XLogPageHeaderData uint16 xlp_info; /* flag bits, see below */ TimeLineID xlp_tli; /* TimeLineID of first record on page */ XLogRecPtr xlp_pageaddr; /* XLOG address of this page */ + + /* + * When there is not enough space on current page for whole record, we + * continue on the next page. xlp_rem_len is the number of bytes + * remaining from a previous page. + * + * Note that xl_rem_len includes backup-block data; that is, it tracks + * xl_tot_len not xl_len in the initial header. Also note that the + * continuation data isn't necessarily aligned. + */ + uint32 xlp_rem_len; /* total len of remaining data for record */ } XLogPageHeaderData; #define SizeOfXLogShortPHD MAXALIGN(sizeof(XLogPageHeaderData)) @@ -115,74 +110,28 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader; (((hdr)->xlp_info & XLP_LONG_HEADER) ? SizeOfXLogLongPHD : SizeOfXLogShortPHD) /* - * We break each logical log file (xlogid value) into segment files of the - * size indicated by XLOG_SEG_SIZE. One possible segment at the end of each - * log file is wasted, to ensure that we don't have problems representing - * last-byte-position-plus-1. + * The XLOG is split into WAL segments (physical files) of the size indicated + * by XLOG_SEG_SIZE. */ #define XLogSegSize ((uint32) XLOG_SEG_SIZE) -#define XLogSegsPerFile (((uint32) 0xffffffff) / XLogSegSize) -#define XLogFileSize (XLogSegsPerFile * XLogSegSize) - - -/* - * Macros for manipulating XLOG pointers - */ - -/* Increment an xlogid/segment pair */ -#define NextLogSeg(logId, logSeg) \ - do { \ - if ((logSeg) >= XLogSegsPerFile-1) \ - { \ - (logId)++; \ - (logSeg) = 0; \ - } \ - else \ - (logSeg)++; \ - } while (0) - -/* Decrement an xlogid/segment pair (assume it's not 0,0) */ -#define PrevLogSeg(logId, logSeg) \ - do { \ - if (logSeg) \ - (logSeg)--; \ - else \ - { \ - (logId)--; \ - (logSeg) = XLogSegsPerFile-1; \ - } \ - } while (0) +#define XLogSegmentsPerXLogId (UINT64CONST(0x100000000) / XLOG_SEG_SIZE) -/* Align a record pointer to next page */ -#define NextLogPage(recptr) \ - do { \ - if ((recptr).xrecoff % XLOG_BLCKSZ != 0) \ - (recptr).xrecoff += \ - (XLOG_BLCKSZ - (recptr).xrecoff % XLOG_BLCKSZ); \ - if ((recptr).xrecoff >= XLogFileSize) \ - { \ - ((recptr).xlogid)++; \ - (recptr).xrecoff = 0; \ - } \ - } while (0) +#define XLogSegNoOffsetToRecPtr(segno, offset, dest) \ + (dest) = (segno) * XLOG_SEG_SIZE + (offset) /* * Compute ID and segment from an XLogRecPtr. * * For XLByteToSeg, do the computation at face value. For XLByteToPrevSeg, - * a boundary byte is taken to be in the previous segment. This is suitable + * a boundary byte is taken to be in the previous segment. This is suitable * for deciding which segment to write given a pointer to a record end, - * for example. (We can assume xrecoff is not zero, since no valid recptr - * can have that.) + * for example. */ -#define XLByteToSeg(xlrp, logId, logSeg) \ - ( logId = (xlrp).xlogid, \ - logSeg = (xlrp).xrecoff / XLogSegSize \ - ) -#define XLByteToPrevSeg(xlrp, logId, logSeg) \ - ( logId = (xlrp).xlogid, \ - logSeg = ((xlrp).xrecoff - 1) / XLogSegSize \ - ) +#define XLByteToSeg(xlrp, logSegNo) \ + logSegNo = (xlrp) / XLogSegSize + +#define XLByteToPrevSeg(xlrp, logSegNo) \ + logSegNo = ((xlrp) - 1) / XLogSegSize /* * Is an XLogRecPtr within a particular XLOG segment? @@ -190,18 +139,15 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader; * For XLByteInSeg, do the computation at face value. For XLByteInPrevSeg, * a boundary byte is taken to be in the previous segment. */ -#define XLByteInSeg(xlrp, logId, logSeg) \ - ((xlrp).xlogid == (logId) && \ - (xlrp).xrecoff / XLogSegSize == (logSeg)) +#define XLByteInSeg(xlrp, logSegNo) \ + (((xlrp) / XLogSegSize) == (logSegNo)) -#define XLByteInPrevSeg(xlrp, logId, logSeg) \ - ((xlrp).xlogid == (logId) && \ - ((xlrp).xrecoff - 1) / XLogSegSize == (logSeg)) +#define XLByteInPrevSeg(xlrp, logSegNo) \ + ((((xlrp) - 1) / XLogSegSize) == (logSegNo)) -/* Check if an xrecoff value is in a plausible range */ -#define XRecOffIsValid(xrecoff) \ - ((xrecoff) % XLOG_BLCKSZ >= SizeOfXLogShortPHD && \ - (XLOG_BLCKSZ - (xrecoff) % XLOG_BLCKSZ) >= SizeOfXLogRecord) +/* Check if an XLogRecPtr value is in a plausible range */ +#define XRecOffIsValid(xlrp) \ + ((xlrp) % XLOG_BLCKSZ >= SizeOfXLogShortPHD) /* * The XLog directory and control file (relative to $PGDATA) @@ -215,14 +161,23 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader; */ #define MAXFNAMELEN 64 -#define XLogFileName(fname, tli, log, seg) \ - snprintf(fname, MAXFNAMELEN, "%08X%08X%08X", tli, log, seg) - -#define XLogFromFileName(fname, tli, log, seg) \ - sscanf(fname, "%08X%08X%08X", tli, log, seg) +#define XLogFileName(fname, tli, logSegNo) \ + snprintf(fname, MAXFNAMELEN, "%08X%08X%08X", tli, \ + (uint32) ((logSegNo) / XLogSegmentsPerXLogId), \ + (uint32) ((logSegNo) % XLogSegmentsPerXLogId)) + +#define XLogFromFileName(fname, tli, logSegNo) \ + do { \ + uint32 log; \ + uint32 seg; \ + sscanf(fname, "%08X%08X%08X", tli, &log, &seg); \ + *logSegNo = (uint64) log * XLogSegmentsPerXLogId + seg; \ + } while (0) -#define XLogFilePath(path, tli, log, seg) \ - snprintf(path, MAXPGPATH, XLOGDIR "/%08X%08X%08X", tli, log, seg) +#define XLogFilePath(path, tli, logSegNo) \ + snprintf(path, MAXPGPATH, XLOGDIR "/%08X%08X%08X", tli, \ + (uint32) ((logSegNo) / XLogSegmentsPerXLogId), \ + (uint32) ((logSegNo) % XLogSegmentsPerXLogId)) #define TLHistoryFileName(fname, tli) \ snprintf(fname, MAXFNAMELEN, "%08X.history", tli) @@ -233,26 +188,66 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader; #define StatusFilePath(path, xlog, suffix) \ snprintf(path, MAXPGPATH, XLOGDIR "/archive_status/%s%s", xlog, suffix) -#define BackupHistoryFileName(fname, tli, log, seg, offset) \ - snprintf(fname, MAXFNAMELEN, "%08X%08X%08X.%08X.backup", tli, log, seg, offset) +#define BackupHistoryFileName(fname, tli, logSegNo, offset) \ + snprintf(fname, MAXFNAMELEN, "%08X%08X%08X.%08X.backup", tli, \ + (uint32) ((logSegNo) / XLogSegmentsPerXLogId), \ + (uint32) ((logSegNo) % XLogSegmentsPerXLogId), offset) + +#define BackupHistoryFilePath(path, tli, logSegNo, offset) \ + snprintf(path, MAXPGPATH, XLOGDIR "/%08X%08X%08X.%08X.backup", tli, \ + (uint32) ((logSegNo) / XLogSegmentsPerXLogId), \ + (uint32) ((logSegNo) % XLogSegmentsPerXLogId), offset) + +/* + * Information logged when we detect a change in one of the parameters + * important for Hot Standby. + */ +typedef struct xl_parameter_change +{ + int MaxConnections; + int max_worker_processes; + int max_prepared_xacts; + int max_locks_per_xact; + int wal_level; + bool wal_log_hints; +} xl_parameter_change; + +/* logs restore point */ +typedef struct xl_restore_point +{ + TimestampTz rp_time; + char rp_name[MAXFNAMELEN]; +} xl_restore_point; -#define BackupHistoryFilePath(path, tli, log, seg, offset) \ - snprintf(path, MAXPGPATH, XLOGDIR "/%08X%08X%08X.%08X.backup", tli, log, seg, offset) +/* End of recovery mark, when we don't do an END_OF_RECOVERY checkpoint */ +typedef struct xl_end_of_recovery +{ + TimestampTz end_time; + TimeLineID ThisTimeLineID; /* new TLI */ + TimeLineID PrevTimeLineID; /* previous TLI we forked off from */ +} xl_end_of_recovery; +/* + * XLogRecord is defined in xlog.h, but we avoid #including that to keep + * this file includable in stand-alone programs. + */ +struct XLogRecord; /* * Method table for resource managers. * - * RmgrTable[] is indexed by RmgrId values (see rmgr.h). + * This struct must be kept in sync with the PG_RMGR definition in + * rmgr.c. + * + * RmgrTable[] is indexed by RmgrId values (see rmgrlist.h). */ typedef struct RmgrData { const char *rm_name; - void (*rm_redo) (XLogRecPtr lsn, XLogRecord *rptr); + void (*rm_redo) (XLogRecPtr lsn, struct XLogRecord *rptr); void (*rm_desc) (StringInfo buf, uint8 xl_info, char *rec); void (*rm_startup) (void); void (*rm_cleanup) (void); - bool (*rm_safe_restartpoint) (void); } RmgrData; extern const RmgrData RmgrTable[]; @@ -263,24 +258,31 @@ extern const RmgrData RmgrTable[]; extern pg_time_t GetLastSegSwitchTime(void); extern XLogRecPtr RequestXLogSwitch(void); +extern void GetOldestRestartPoint(XLogRecPtr *oldrecptr, TimeLineID *oldtli); + +/* + * Exported for the functions in timeline.c and xlogarchive.c. Only valid + * in the startup process. + */ +extern bool ArchiveRecoveryRequested; +extern bool InArchiveRecovery; +extern bool StandbyMode; +extern char *recoveryRestoreCommand; + /* - * These aren't in xlog.h because I'd rather not include fmgr.h there. + * Prototypes for functions in xlogarchive.c */ -extern Datum pg_start_backup(PG_FUNCTION_ARGS); -extern Datum pg_stop_backup(PG_FUNCTION_ARGS); -extern Datum pg_switch_xlog(PG_FUNCTION_ARGS); -extern Datum pg_create_restore_point(PG_FUNCTION_ARGS); -extern Datum pg_current_xlog_location(PG_FUNCTION_ARGS); -extern Datum pg_current_xlog_insert_location(PG_FUNCTION_ARGS); -extern Datum pg_last_xlog_receive_location(PG_FUNCTION_ARGS); -extern Datum pg_last_xlog_replay_location(PG_FUNCTION_ARGS); -extern Datum pg_last_xact_replay_timestamp(PG_FUNCTION_ARGS); -extern Datum pg_xlogfile_name_offset(PG_FUNCTION_ARGS); -extern Datum pg_xlogfile_name(PG_FUNCTION_ARGS); -extern Datum pg_is_in_recovery(PG_FUNCTION_ARGS); -extern Datum pg_xlog_replay_pause(PG_FUNCTION_ARGS); -extern Datum pg_xlog_replay_resume(PG_FUNCTION_ARGS); -extern Datum pg_is_xlog_replay_paused(PG_FUNCTION_ARGS); -extern Datum pg_xlog_location_diff(PG_FUNCTION_ARGS); +extern bool RestoreArchivedFile(char *path, const char *xlogfname, + const char *recovername, off_t expectedSize, + bool cleanupEnabled); +extern void ExecuteRecoveryCommand(char *command, char *commandName, + bool failOnerror); +extern void KeepFileRestoredFromArchive(char *path, char *xlogfname); +extern void XLogArchiveNotify(const char *xlog); +extern void XLogArchiveNotifySeg(XLogSegNo segno); +extern void XLogArchiveForceDone(const char *xlog); +extern bool XLogArchiveCheckDone(const char *xlog); +extern bool XLogArchiveIsBusy(const char *xlog); +extern void XLogArchiveCleanup(const char *xlog); #endif /* XLOG_INTERNAL_H */ diff --git a/src/include/access/xlogdefs.h b/src/include/access/xlogdefs.h index 5e6d7e600b..3b8e738eac 100644 --- a/src/include/access/xlogdefs.h +++ b/src/include/access/xlogdefs.h @@ -4,7 +4,7 @@ * Postgres transaction log manager record pointer and * timeline number definitions * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/xlogdefs.h @@ -17,60 +17,21 @@ /* * Pointer to a location in the XLOG. These pointers are 64 bits wide, * because we don't want them ever to overflow. - * - * NOTE: xrecoff == 0 is used to indicate an invalid pointer. This is OK - * because we use page headers in the XLOG, so no XLOG record can start - * right at the beginning of a file. - * - * NOTE: the "log file number" is somewhat misnamed, since the actual files - * making up the XLOG are much smaller than 4Gb. Each actual file is an - * XLogSegSize-byte "segment" of a logical log file having the indicated - * xlogid. The log file number and segment number together identify a - * physical XLOG file. Segment number and offset within the physical file - * are computed from xrecoff div and mod XLogSegSize. */ -typedef struct XLogRecPtr -{ - uint32 xlogid; /* log file #, 0 based */ - uint32 xrecoff; /* byte offset of location in log file */ -} XLogRecPtr; - -#define XLogRecPtrIsInvalid(r) ((r).xrecoff == 0) - +typedef uint64 XLogRecPtr; /* - * Macros for comparing XLogRecPtrs - * - * Beware of passing expressions with side-effects to these macros, - * since the arguments may be evaluated multiple times. + * Zero is used indicate an invalid pointer. Bootstrap skips the first possible + * WAL segment, initializing the first WAL page at XLOG_SEG_SIZE, so no XLOG + * record can begin at zero. */ -#define XLByteLT(a, b) \ - ((a).xlogid < (b).xlogid || \ - ((a).xlogid == (b).xlogid && (a).xrecoff < (b).xrecoff)) - -#define XLByteLE(a, b) \ - ((a).xlogid < (b).xlogid || \ - ((a).xlogid == (b).xlogid && (a).xrecoff <= (b).xrecoff)) - -#define XLByteEQ(a, b) \ - ((a).xlogid == (b).xlogid && (a).xrecoff == (b).xrecoff) - +#define InvalidXLogRecPtr 0 +#define XLogRecPtrIsInvalid(r) ((r) == InvalidXLogRecPtr) /* - * Macro for advancing a record pointer by the specified number of bytes. + * XLogSegNo - physical log file sequence number. */ -#define XLByteAdvance(recptr, nbytes) \ - do { \ - if (recptr.xrecoff + nbytes >= XLogFileSize) \ - { \ - recptr.xlogid += 1; \ - recptr.xrecoff \ - = recptr.xrecoff + nbytes - XLogFileSize; \ - } \ - else \ - recptr.xrecoff += nbytes; \ - } while (0) - +typedef uint64 XLogSegNo; /* * TimeLineID (TLI) - identifies different database histories to prevent @@ -88,7 +49,7 @@ typedef uint32 TimeLineID; * read those buffers except during crash recovery or if wal_level != minimal, * it is a win to use it in all cases where we sync on each write(). We could * allow O_DIRECT with fsync(), but it is unclear if fsync() could process - * writes not buffered in the kernel. Also, O_DIRECT is never enough to force + * writes not buffered in the kernel. Also, O_DIRECT is never enough to force * data to the drives, it merely tries to bypass the kernel cache, so we still * need O_SYNC/O_DSYNC. */ @@ -101,7 +62,7 @@ typedef uint32 TimeLineID; /* * This chunk of hackery attempts to determine which file sync methods * are available on the current platform, and to choose an appropriate - * default method. We assume that fsync() is always available, and that + * default method. We assume that fsync() is always available, and that * configure determined whether fdatasync() is. */ #if defined(O_SYNC) @@ -132,14 +93,4 @@ typedef uint32 TimeLineID; #define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC #endif -/* - * Limitation of buffer-alignment for direct IO depends on OS and filesystem, - * but XLOG_BLCKSZ is assumed to be enough for it. - */ -#ifdef O_DIRECT -#define ALIGNOF_XLOG_BUFFER XLOG_BLCKSZ -#else -#define ALIGNOF_XLOG_BUFFER ALIGNOF_BUFFER -#endif - #endif /* XLOG_DEFS_H */ diff --git a/src/include/access/xlogreader.h b/src/include/access/xlogreader.h new file mode 100644 index 0000000000..ea873a2d9c --- /dev/null +++ b/src/include/access/xlogreader.h @@ -0,0 +1,126 @@ +/*------------------------------------------------------------------------- + * + * xlogreader.h + * Definitions for the generic XLog reading facility + * + * Portions Copyright (c) 2013-2014, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/access/xlogreader.h + * + * NOTES + * See the definition of the XLogReaderState struct for instructions on + * how to use the XLogReader infrastructure. + * + * The basic idea is to allocate an XLogReaderState via + * XLogReaderAllocate(), and call XLogReadRecord() until it returns NULL. + *------------------------------------------------------------------------- + */ +#ifndef XLOGREADER_H +#define XLOGREADER_H + +#include "access/xlog_internal.h" + +typedef struct XLogReaderState XLogReaderState; + +/* Function type definition for the read_page callback */ +typedef int (*XLogPageReadCB) (XLogReaderState *xlogreader, + XLogRecPtr targetPagePtr, + int reqLen, + XLogRecPtr targetRecPtr, + char *readBuf, + TimeLineID *pageTLI); + +struct XLogReaderState +{ + /* ---------------------------------------- + * Public parameters + * ---------------------------------------- + */ + + /* + * Data input callback (mandatory). + * + * This callback shall read at least reqLen valid bytes of the xlog page + * starting at targetPagePtr, and store them in readBuf. The callback + * shall return the number of bytes read (never more than XLOG_BLCKSZ), or + * -1 on failure. The callback shall sleep, if necessary, to wait for the + * requested bytes to become available. The callback will not be invoked + * again for the same page unless more than the returned number of bytes + * are needed. + * + * targetRecPtr is the position of the WAL record we're reading. Usually + * it is equal to targetPagePtr + reqLen, but sometimes xlogreader needs + * to read and verify the page or segment header, before it reads the + * actual WAL record it's interested in. In that case, targetRecPtr can + * be used to determine which timeline to read the page from. + * + * The callback shall set *pageTLI to the TLI of the file the page was + * read from. It is currently used only for error reporting purposes, to + * reconstruct the name of the WAL file where an error occurred. + */ + XLogPageReadCB read_page; + + /* + * System identifier of the xlog files we're about to read. Set to zero + * (the default value) if unknown or unimportant. + */ + uint64 system_identifier; + + /* + * Opaque data for callbacks to use. Not used by XLogReader. + */ + void *private_data; + + /* + * Start and end point of last record read. EndRecPtr is also used as the + * position to read next, if XLogReadRecord receives an invalid recptr. + */ + XLogRecPtr ReadRecPtr; /* start of last record read */ + XLogRecPtr EndRecPtr; /* end+1 of last record read */ + + /* ---------------------------------------- + * private/internal state + * ---------------------------------------- + */ + + /* Buffer for currently read page (XLOG_BLCKSZ bytes) */ + char *readBuf; + + /* last read segment, segment offset, read length, TLI */ + XLogSegNo readSegNo; + uint32 readOff; + uint32 readLen; + TimeLineID readPageTLI; + + /* beginning of last page read, and its TLI */ + XLogRecPtr latestPagePtr; + TimeLineID latestPageTLI; + + /* beginning of the WAL record being read. */ + XLogRecPtr currRecPtr; + + /* Buffer for current ReadRecord result (expandable) */ + char *readRecordBuf; + uint32 readRecordBufSize; + + /* Buffer to hold error message */ + char *errormsg_buf; +}; + +/* Get a new XLogReader */ +extern XLogReaderState *XLogReaderAllocate(XLogPageReadCB pagereadfunc, + void *private_data); + +/* Free an XLogReader */ +extern void XLogReaderFree(XLogReaderState *state); + +/* Read the next XLog record. Returns NULL on end-of-WAL or failure */ +extern struct XLogRecord *XLogReadRecord(XLogReaderState *state, + XLogRecPtr recptr, char **errormsg); + +#ifdef FRONTEND +extern XLogRecPtr XLogFindNextRecord(XLogReaderState *state, XLogRecPtr RecPtr); +#endif /* FRONTEND */ + +#endif /* XLOGREADER_H */ diff --git a/src/include/access/xlogutils.h b/src/include/access/xlogutils.h index 6ade4769ca..58f11d919b 100644 --- a/src/include/access/xlogutils.h +++ b/src/include/access/xlogutils.h @@ -3,7 +3,7 @@ * * PostgreSQL transaction log manager utility routines * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/xlogutils.h diff --git a/src/include/bootstrap/bootstrap.h b/src/include/bootstrap/bootstrap.h index 7f0ed6db2b..aebabec453 100644 --- a/src/include/bootstrap/bootstrap.h +++ b/src/include/bootstrap/bootstrap.h @@ -4,7 +4,7 @@ * include file for the bootstrapping code * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 2010-2012 Postgres-XC Development Group * @@ -17,20 +17,6 @@ #include "nodes/execnodes.h" -typedef enum -{ - CheckerProcess, - BootstrapProcess, - StartupProcess, - BgWriterProcess, - CheckpointerProcess, - WalWriterProcess, - WalReceiverProcess, -#ifdef PGXC - PoolerProcess, -#endif - NUM_AUXPROCTYPES /* Must be last! */ -} AuxProcType; /* * MAXATTR is the maximum number of attributes in a relation supported @@ -43,7 +29,7 @@ extern Form_pg_attribute attrtypes[MAXATTR]; extern int numattr; -extern void AuxiliaryProcessMain(int argc, char *argv[]); +extern void AuxiliaryProcessMain(int argc, char *argv[]) __attribute__((noreturn)); extern void err_out(void); diff --git a/src/include/c.h b/src/include/c.h index 8b3c5e5996..df22d50d4e 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -9,7 +9,7 @@ * polluting the namespace with lots of stuff... * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/c.h @@ -31,12 +31,13 @@ * 3) standard system types * 4) IsValid macros for system types * 5) offsetof, lengthof, endof, alignment - * 6) widely useful macros - * 7) random stuff - * 8) system-specific hacks + * 6) assertions + * 7) widely useful macros + * 8) random stuff + * 9) system-specific hacks * * NOTE: since this file is included by both frontend and backend modules, it's - * almost certainly wrong to put an "extern" declaration here. typedefs and + * almost certainly wrong to put an "extern" declaration here. typedefs and * macros are the kind of thing that might go here. * *---------------------------------------------------------------- @@ -44,19 +45,26 @@ #ifndef C_H #define C_H -/* - * We have to include stdlib.h here because it defines many of these macros - * on some platforms, and we only want our definitions used if stdlib.h doesn't - * have its own. The same goes for stddef and stdarg if present. - */ +#include "postgres_ext.h" + +/* Must undef pg_config_ext.h symbols before including pg_config.h */ +#undef PG_INT64_TYPE #include "pg_config.h" #include "pg_config_manual.h" /* must be after pg_config.h */ -#if !defined(WIN32) && !defined(__CYGWIN__) /* win32 will include further - * down */ + +/* + * We always rely on the WIN32 macro being set by our build system, + * but _WIN32 is the compiler pre-defined macro. So make sure we define + * WIN32 whenever _WIN32 is set, to facilitate standalone building. + */ +#if defined(_WIN32) && !defined(WIN32) +#define WIN32 +#endif + +#if !defined(WIN32) && !defined(__CYGWIN__) /* win32 includes further down */ #include "pg_config_os.h" /* must be before any system header files */ #endif -#include "postgres_ext.h" #if _MSC_VER >= 1400 || defined(HAVE_CRTDEFS_H) #define errcode __msvc_errcode @@ -64,6 +72,12 @@ #undef errcode #endif +/* + * We have to include stdlib.h here because it defines many of these macros + * on some platforms, and we only want our definitions used if stdlib.h doesn't + * have its own. The same goes for stddef and stdarg if present. + */ + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -103,7 +117,7 @@ /* * Use this to mark string constants as needing translation at some later - * time, rather than immediately. This is useful for cases where you need + * time, rather than immediately. This is useful for cases where you need * access to the original string and translated string, and for cases where * immediate translation is not possible, like when initializing global * variables. @@ -125,28 +139,12 @@ * CppConcat * Concatenate two arguments together, using the C preprocessor. * - * Note: the standard Autoconf macro AC_C_STRINGIZE actually only checks - * whether #identifier works, but if we have that we likely have ## too. + * Note: There used to be support here for pre-ANSI C compilers that didn't + * support # and ##. Nowadays, these macros are just for clarity and/or + * backward compatibility with existing PostgreSQL code. */ -#if defined(HAVE_STRINGIZE) - #define CppAsString(identifier) #identifier #define CppConcat(x, y) x##y -#else /* !HAVE_STRINGIZE */ - -#define CppAsString(identifier) "identifier" - -/* - * CppIdentity -- On Reiser based cpp's this is used to concatenate - * two tokens. That is - * CppIdentity(A)B ==> AB - * We renamed it to _private_CppIdentity because it should not - * be referenced outside this file. On other cpp's it - * produces A B. - */ -#define _priv_CppIdentity(x)x -#define CppConcat(x, y) _priv_CppIdentity(x)y -#endif /* !HAVE_STRINGIZE */ /* * dummyret is used to set return values in macros that use ?: to make @@ -329,8 +327,6 @@ typedef signed int Offset; /* * Common Postgres datatype names (as used in the catalogs) */ -typedef int16 int2; -typedef int32 int4; typedef float float4; typedef double float8; @@ -365,6 +361,7 @@ typedef uint32 MultiXactOffset; typedef uint32 CommandId; #define FirstCommandId ((CommandId) 0) +#define InvalidCommandId (~(CommandId)0) /* * Array indexing support @@ -379,7 +376,7 @@ typedef struct * Variable-length datatypes all share the 'struct varlena' header. * * NOTE: for TOASTable types, this is an oversimplification, since the value - * may be compressed or moved out-of-line. However datatype-specific routines + * may be compressed or moved out-of-line. However datatype-specific routines * are mostly content to deal with de-TOASTed values only, and of course * client-side routines should never see a TOASTed value. But even in a * de-TOASTed value, beware of touching vl_len_ directly, as its representation @@ -409,7 +406,7 @@ typedef struct varlena VarChar; /* var-length char, ie SQL varchar(n) */ /* * Specialized array types. These are physically laid out just the same * as regular arrays (so that the regular array subscripting code works - * with them). They exist as distinct types mostly for historical reasons: + * with them). They exist as distinct types mostly for historical reasons: * they have nonstandard I/O behavior which we don't want to change for fear * of breaking applications that look at the system catalogs. There is also * an implementation issue for oidvector: it's part of the primary key for @@ -424,7 +421,7 @@ typedef struct Oid elemtype; int dim1; int lbound1; - int2 values[1]; /* VARIABLE LENGTH ARRAY */ + int16 values[1]; /* VARIABLE LENGTH ARRAY */ } int2vector; /* VARIABLE LENGTH STRUCT */ typedef struct @@ -452,7 +449,7 @@ typedef NameData *Name; /* * Support macros for escaping strings. escape_backslash should be TRUE - * if generating a non-standard-conforming string. Prefixing a string + * if generating a non-standard-conforming string. Prefixing a string * with ESCAPE_STRING_SYNTAX guarantees it is non-standard-conforming. * Beware of multiple evaluation of the "ch" argument! */ @@ -482,7 +479,7 @@ typedef NameData *Name; * True iff pointer is properly aligned to point to the given type. */ #define PointerIsAligned(pointer, type) \ - (((intptr_t)(pointer) % (sizeof (type))) == 0) + (((uintptr_t)(pointer) % (sizeof (type))) == 0) #define OidIsValid(objectId) ((bool) ((objectId) != InvalidOid)) @@ -528,7 +525,7 @@ typedef NameData *Name; */ #define TYPEALIGN(ALIGNVAL,LEN) \ - (((intptr_t) (LEN) + ((ALIGNVAL) - 1)) & ~((intptr_t) ((ALIGNVAL) - 1))) + (((uintptr_t) (LEN) + ((ALIGNVAL) - 1)) & ~((uintptr_t) ((ALIGNVAL) - 1))) #define SHORTALIGN(LEN) TYPEALIGN(ALIGNOF_SHORT, (LEN)) #define INTALIGN(LEN) TYPEALIGN(ALIGNOF_INT, (LEN)) @@ -539,7 +536,7 @@ typedef NameData *Name; #define BUFFERALIGN(LEN) TYPEALIGN(ALIGNOF_BUFFER, (LEN)) #define TYPEALIGN_DOWN(ALIGNVAL,LEN) \ - (((intptr_t) (LEN)) & ~((intptr_t) ((ALIGNVAL) - 1))) + (((uintptr_t) (LEN)) & ~((uintptr_t) ((ALIGNVAL) - 1))) #define SHORTALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_SHORT, (LEN)) #define INTALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_INT, (LEN)) @@ -547,8 +544,147 @@ typedef NameData *Name; #define DOUBLEALIGN_DOWN(LEN) TYPEALIGN_DOWN(ALIGNOF_DOUBLE, (LEN)) #define MAXALIGN_DOWN(LEN) TYPEALIGN_DOWN(MAXIMUM_ALIGNOF, (LEN)) +/* + * The above macros will not work with types wider than uintptr_t, like with + * uint64 on 32-bit platforms. That's not problem for the usual use where a + * pointer or a length is aligned, but for the odd case that you need to + * align something (potentially) wider, use TYPEALIGN64. + */ +#define TYPEALIGN64(ALIGNVAL,LEN) \ + (((uint64) (LEN) + ((ALIGNVAL) - 1)) & ~((uint64) ((ALIGNVAL) - 1))) + +/* we don't currently need wider versions of the other ALIGN macros */ +#define MAXALIGN64(LEN) TYPEALIGN64(MAXIMUM_ALIGNOF, (LEN)) + /* ---------------------------------------------------------------- - * Section 6: widely useful macros + * Section 6: assertions + * ---------------------------------------------------------------- + */ + +/* + * USE_ASSERT_CHECKING, if defined, turns on all the assertions. + * - plai 9/5/90 + * + * It should _NOT_ be defined in releases or in benchmark copies + */ + +/* + * Assert() can be used in both frontend and backend code. In frontend code it + * just calls the standard assert, if it's available. If use of assertions is + * not configured, it does nothing. + */ +#ifndef USE_ASSERT_CHECKING + +#define Assert(condition) +#define AssertMacro(condition) ((void)true) +#define AssertArg(condition) +#define AssertState(condition) +#define Trap(condition, errorType) +#define TrapMacro(condition, errorType) (true) + +#elif defined(FRONTEND) + +#include <assert.h> +#define Assert(p) assert(p) +#define AssertMacro(p) ((void) assert(p)) +#define AssertArg(condition) assert(condition) +#define AssertState(condition) assert(condition) +#else /* USE_ASSERT_CHECKING && !FRONTEND */ + +/* + * Trap + * Generates an exception if the given condition is true. + */ +#define Trap(condition, errorType) \ + do { \ + if ((assert_enabled) && (condition)) \ + ExceptionalCondition(CppAsString(condition), (errorType), \ + __FILE__, __LINE__); \ + } while (0) + +/* + * TrapMacro is the same as Trap but it's intended for use in macros: + * + * #define foo(x) (AssertMacro(x != 0), bar(x)) + * + * Isn't CPP fun? + */ +#define TrapMacro(condition, errorType) \ + ((bool) ((! assert_enabled) || ! (condition) || \ + (ExceptionalCondition(CppAsString(condition), (errorType), \ + __FILE__, __LINE__), 0))) + +#define Assert(condition) \ + Trap(!(condition), "FailedAssertion") + +#define AssertMacro(condition) \ + ((void) TrapMacro(!(condition), "FailedAssertion")) + +#define AssertArg(condition) \ + Trap(!(condition), "BadArgument") + +#define AssertState(condition) \ + Trap(!(condition), "BadState") +#endif /* USE_ASSERT_CHECKING && !FRONTEND */ + + +/* + * Macros to support compile-time assertion checks. + * + * If the "condition" (a compile-time-constant expression) evaluates to false, + * throw a compile error using the "errmessage" (a string literal). + * + * gcc 4.6 and up supports _Static_assert(), but there are bizarre syntactic + * placement restrictions. These macros make it safe to use as a statement + * or in an expression, respectively. + * + * Otherwise we fall back on a kluge that assumes the compiler will complain + * about a negative width for a struct bit-field. This will not include a + * helpful error message, but it beats not getting an error at all. + */ +#ifdef HAVE__STATIC_ASSERT +#define StaticAssertStmt(condition, errmessage) \ + do { _Static_assert(condition, errmessage); } while(0) +#define StaticAssertExpr(condition, errmessage) \ + ({ StaticAssertStmt(condition, errmessage); true; }) +#else /* !HAVE__STATIC_ASSERT */ +#define StaticAssertStmt(condition, errmessage) \ + ((void) sizeof(struct { int static_assert_failure : (condition) ? 1 : -1; })) +#define StaticAssertExpr(condition, errmessage) \ + StaticAssertStmt(condition, errmessage) +#endif /* HAVE__STATIC_ASSERT */ + + +/* + * Compile-time checks that a variable (or expression) has the specified type. + * + * AssertVariableIsOfType() can be used as a statement. + * AssertVariableIsOfTypeMacro() is intended for use in macros, eg + * #define foo(x) (AssertVariableIsOfTypeMacro(x, int), bar(x)) + * + * If we don't have __builtin_types_compatible_p, we can still assert that + * the types have the same size. This is far from ideal (especially on 32-bit + * platforms) but it provides at least some coverage. + */ +#ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P +#define AssertVariableIsOfType(varname, typename) \ + StaticAssertStmt(__builtin_types_compatible_p(__typeof__(varname), typename), \ + CppAsString(varname) " does not have type " CppAsString(typename)) +#define AssertVariableIsOfTypeMacro(varname, typename) \ + ((void) StaticAssertExpr(__builtin_types_compatible_p(__typeof__(varname), typename), \ + CppAsString(varname) " does not have type " CppAsString(typename))) +#else /* !HAVE__BUILTIN_TYPES_COMPATIBLE_P */ +#define AssertVariableIsOfType(varname, typename) \ + StaticAssertStmt(sizeof(varname) == sizeof(typename), \ + CppAsString(varname) " does not have type " CppAsString(typename)) +#define AssertVariableIsOfTypeMacro(varname, typename) \ + ((void) StaticAssertExpr(sizeof(varname) == sizeof(typename), \ + CppAsString(varname) " does not have type " CppAsString(typename))) +#endif /* HAVE__BUILTIN_TYPES_COMPATIBLE_P */ + + +/* ---------------------------------------------------------------- + * Section 7: widely useful macros * ---------------------------------------------------------------- */ /* @@ -581,7 +717,7 @@ typedef NameData *Name; * datum) and add a null, do not do it with StrNCpy(..., len+1). That * might seem to work, but it fetches one byte more than there is in the * text object. One fine day you'll have a SIGSEGV because there isn't - * another byte before the end of memory. Don't laugh, we've had real + * another byte before the end of memory. Don't laugh, we've had real * live bug reports from real live users over exactly this mistake. * Do it honestly with "memcpy(dst,src,len); dst[len] = '\0';", instead. */ @@ -607,7 +743,7 @@ typedef NameData *Name; * Exactly the same as standard library function memset(), but considerably * faster for zeroing small word-aligned structures (such as parsetree nodes). * This has to be a macro because the main point is to avoid function-call - * overhead. However, we have also found that the loop is faster than + * overhead. However, we have also found that the loop is faster than * native libc memset() on some platforms, even those with assembler * memset() functions. More research needs to be done, perhaps with * MEMSET_LOOP_LIMIT tests in configure. @@ -620,7 +756,7 @@ typedef NameData *Name; int _val = (val); \ Size _len = (len); \ \ - if ((((intptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \ + if ((((uintptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \ (_len & LONG_ALIGN_MASK) == 0 && \ _val == 0 && \ _len <= MEMSET_LOOP_LIMIT && \ @@ -691,8 +827,40 @@ typedef NameData *Name; } while (0) +/* + * Mark a point as unreachable in a portable fashion. This should preferably + * be something that the compiler understands, to aid code generation. + * In assert-enabled builds, we prefer abort() for debugging reasons. + */ +#if defined(HAVE__BUILTIN_UNREACHABLE) && !defined(USE_ASSERT_CHECKING) +#define pg_unreachable() __builtin_unreachable() +#elif defined(_MSC_VER) && !defined(USE_ASSERT_CHECKING) +#define pg_unreachable() __assume(0) +#else +#define pg_unreachable() abort() +#endif + + +/* + * Function inlining support -- Allow modules to define functions that may be + * inlined, if the compiler supports it. + * + * The function bodies must be defined in the module header prefixed by + * STATIC_IF_INLINE, protected by a cpp symbol that the module's .c file must + * define. If the compiler doesn't support inline functions, the function + * definitions are pulled in by the .c file as regular (not inline) symbols. + * + * The header must also declare the functions' prototypes, protected by + * !PG_USE_INLINE. + */ +#ifdef PG_USE_INLINE +#define STATIC_IF_INLINE static inline +#else +#define STATIC_IF_INLINE +#endif /* PG_USE_INLINE */ + /* ---------------------------------------------------------------- - * Section 7: random stuff + * Section 8: random stuff * ---------------------------------------------------------------- */ @@ -746,10 +914,10 @@ typedef NameData *Name; /* ---------------------------------------------------------------- - * Section 8: system-specific hacks + * Section 9: system-specific hacks * * This should be limited to things that absolutely have to be - * included in every source file. The port-specific header file + * included in every source file. The port-specific header file * is usually a better place for this sort of thing. * ---------------------------------------------------------------- */ @@ -758,7 +926,7 @@ typedef NameData *Name; * NOTE: this is also used for opening text files. * WIN32 treats Control-Z as EOF in files opened in text mode. * Therefore, we open files in binary mode on Win32 so we can read - * literal control-Z. The other affect is that we see CRLF, but + * literal control-Z. The other affect is that we see CRLF, but * that is OK because we can already handle those cleanly. */ #if defined(WIN32) || defined(__CYGWIN__) diff --git a/src/include/catalog/binary_upgrade.h b/src/include/catalog/binary_upgrade.h new file mode 100644 index 0000000000..f39017cfdf --- /dev/null +++ b/src/include/catalog/binary_upgrade.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * binary_upgrade.h + * variables used for binary upgrades + * + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/binary_upgrade.h + * + *------------------------------------------------------------------------- + */ +#ifndef BINARY_UPGRADE_H +#define BINARY_UPGRADE_H + +extern PGDLLIMPORT Oid binary_upgrade_next_pg_type_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_array_pg_type_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_toast_pg_type_oid; + +extern PGDLLIMPORT Oid binary_upgrade_next_heap_pg_class_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_index_pg_class_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_toast_pg_class_oid; + +extern PGDLLIMPORT Oid binary_upgrade_next_pg_enum_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_pg_authid_oid; + +#endif /* BINARY_UPGRADE_H */ diff --git a/src/include/catalog/catalog.h b/src/include/catalog/catalog.h index 5a1861da6e..56009efebf 100644 --- a/src/include/catalog/catalog.h +++ b/src/include/catalog/catalog.h @@ -9,7 +9,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/catalog.h @@ -25,39 +25,20 @@ */ #include "catalog/catversion.h" /* pgrminclude ignore */ #include "catalog/pg_class.h" -#include "storage/relfilenode.h" #include "utils/relcache.h" #define OIDCHARS 10 /* max chars printed by %u */ #define TABLESPACE_VERSION_DIRECTORY "PG_" PG_MAJORVERSION "_" \ CppAsString2(CATALOG_VERSION_NO) -extern const char *forkNames[]; -extern ForkNumber forkname_to_number(char *forkName); -extern int forkname_chars(const char *str, ForkNumber *); - -extern char *relpathbackend(RelFileNode rnode, BackendId backend, - ForkNumber forknum); -extern char *GetDatabasePath(Oid dbNode, Oid spcNode); - -/* First argument is a RelFileNodeBackend */ -#ifdef XCP -#define relpath(rnode, forknum) \ - relpathbackend((rnode).node, InvalidBackendId, (forknum)) -#else -#define relpath(rnode, forknum) \ - relpathbackend((rnode).node, (rnode).backend, (forknum)) -#endif - -/* First argument is a RelFileNode */ -#define relpathperm(rnode, forknum) \ - relpathbackend((rnode), InvalidBackendId, (forknum)) extern bool IsSystemRelation(Relation relation); extern bool IsToastRelation(Relation relation); +extern bool IsCatalogRelation(Relation relation); -extern bool IsSystemClass(Form_pg_class reltuple); +extern bool IsSystemClass(Oid relid, Form_pg_class reltuple); extern bool IsToastClass(Form_pg_class reltuple); +extern bool IsCatalogClass(Oid relid, Form_pg_class reltuple); extern bool IsSystemNamespace(Oid namespaceId); extern bool IsToastNamespace(Oid namespaceId); diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index fe020a692c..93afbbe033 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -4,7 +4,7 @@ * "Catalog version number" for PostgreSQL. * * The catalog version number is used to flag incompatible changes in - * the PostgreSQL system catalogs. Whenever anyone changes the format of + * the PostgreSQL system catalogs. Whenever anyone changes the format of * a system catalog relation, or adds, deletes, or modifies standard * catalog entries in such a way that an updated backend wouldn't work * with an old database (or vice versa), the catalog version number @@ -34,7 +34,7 @@ * database contents or layout, such as altering tuple headers. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/catversion.h @@ -53,10 +53,6 @@ */ /* yyyymmddN */ -#ifdef PGXC -#define CATALOG_VERSION_NO 201204301 -#else -#define CATALOG_VERSION_NO 201204301 -#endif +#define CATALOG_VERSION_NO 201406051 #endif diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h index 79afd25651..54e9d25309 100644 --- a/src/include/catalog/dependency.h +++ b/src/include/catalog/dependency.h @@ -4,7 +4,7 @@ * Routines to support inter-object dependencies. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 2010-2012 Postgres-XC Development Group * @@ -59,7 +59,7 @@ * DEPENDENCY_PIN ('p'): there is no dependent object; this type of entry * is a signal that the system itself depends on the referenced object, * and so that object must never be deleted. Entries of this type are - * created only during initdb. The fields for the dependent object + * created only during initdb. The fields for the dependent object * contain zeroes. * * Other dependency flavors may be needed in future. @@ -152,7 +152,8 @@ typedef enum ObjectClass #endif OCLASS_DEFACL, /* pg_default_acl */ OCLASS_EXTENSION, /* pg_extension */ - MAX_OCLASS /* MUST BE LAST */ + OCLASS_EVENT_TRIGGER, /* pg_event_trigger */ + MAX_OCLASS /* MUST BE LAST */ } ObjectClass; @@ -187,9 +188,6 @@ extern void recordDependencyOnSingleRelExpr(const ObjectAddress *depender, extern ObjectClass getObjectClass(const ObjectAddress *object); -extern char *getObjectDescription(const ObjectAddress *object); -extern char *getObjectDescriptionOids(Oid classid, Oid objid); - extern ObjectAddresses *new_object_addresses(void); extern void add_exact_object_address(const ObjectAddress *object, diff --git a/src/include/catalog/duplicate_oids b/src/include/catalog/duplicate_oids index be65f4329d..b5bd5db04d 100755 --- a/src/include/catalog/duplicate_oids +++ b/src/include/catalog/duplicate_oids @@ -1,30 +1,36 @@ -#!/bin/sh -# -# duplicate_oids -# -# src/include/catalog/duplicate_oids -# -# finds manually-assigned oids that are duplicated in the system tables. -# -# run this script in src/include/catalog. -# +#!/usr/bin/perl -# note: we exclude BKI_BOOTSTRAP relations since they are expected to have -# matching DATA lines in pg_class.h and pg_type.h +use strict; +use warnings; -cat pgxc_*.h pg_*.h toasting.h indexing.h | \ -egrep -v -e '^CATALOG\(.*BKI_BOOTSTRAP' | \ -sed -n -e 's/^DATA(insert *OID *= *\([0-9][0-9]*\).*$/\1/p' \ - -e 's/^CATALOG([^,]*, *\([0-9][0-9]*\).*BKI_ROWTYPE_OID(\([0-9][0-9]*\)).*$/\1,\2/p' \ - -e 's/^CATALOG([^,]*, *\([0-9][0-9]*\).*$/\1/p' \ - -e 's/^DECLARE_INDEX([^,]*, *\([0-9][0-9]*\).*$/\1/p' \ - -e 's/^DECLARE_UNIQUE_INDEX([^,]*, *\([0-9][0-9]*\).*$/\1/p' \ - -e 's/^DECLARE_TOAST([^,]*, *\([0-9][0-9]*\), *\([0-9][0-9]*\).*$/\1,\2/p' | \ -tr ',' '\n' | \ -sort -n | \ -uniq -d | \ -grep '.' +BEGIN +{ + @ARGV = (glob("pg_*.h"), glob("pgxc_*.h"), qw(indexing.h toasting.h)); +} -# nonzero exit code if lines were produced -[ $? -eq 1 ] -exit +my %oidcounts; + +while (<>) +{ + next if /^CATALOG\(.*BKI_BOOTSTRAP/; + next + unless /^DATA\(insert *OID *= *(\d+)/ + || /^CATALOG\([^,]*, *(\d+).*BKI_ROWTYPE_OID\((\d+)\)/ + || /^CATALOG\([^,]*, *(\d+)/ + || /^DECLARE_INDEX\([^,]*, *(\d+)/ + || /^DECLARE_UNIQUE_INDEX\([^,]*, *(\d+)/ + || /^DECLARE_TOAST\([^,]*, *(\d+), *(\d+)/; + $oidcounts{$1}++; + $oidcounts{$2}++ if $2; +} + +my $found = 0; + +foreach my $oid (sort { $a <=> $b } keys %oidcounts) +{ + next unless $oidcounts{$oid} > 1; + $found = 1; + print "$oid\n"; +} + +exit $found; diff --git a/src/include/catalog/genbki.h b/src/include/catalog/genbki.h index f973580e5f..cb40c07063 100644 --- a/src/include/catalog/genbki.h +++ b/src/include/catalog/genbki.h @@ -9,7 +9,7 @@ * bootstrap file from these header files.) * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/genbki.h @@ -27,7 +27,7 @@ * * Variable-length catalog fields (except possibly the first not nullable one) * should not be visible in C structures, so they are made invisible by #ifdefs - * of an undefined symbol. See also MARKNOTNULL in bootstrap.c for how this is + * of an undefined symbol. See also MARKNOTNULL in bootstrap.c for how this is * handled. */ #undef CATALOG_VARLEN diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h index 88a61ce3d5..2a452ba65d 100644 --- a/src/include/catalog/heap.h +++ b/src/include/catalog/heap.h @@ -4,7 +4,7 @@ * prototypes for functions in backend/catalog/heap.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 2010-2012 Postgres-XC Development Group * @@ -68,7 +68,8 @@ extern Oid heap_create_with_catalog(const char *relname, OnCommitAction oncommit, Datum reloptions, bool use_user_acl, - bool allow_system_table_mods); + bool allow_system_table_mods, + bool is_internal); extern void heap_create_init_fork(Relation rel); @@ -96,9 +97,11 @@ extern List *AddRelationNewConstraints(Relation rel, List *newColDefaults, List *newConstraints, bool allow_merge, - bool is_local); + bool is_local, + bool is_internal); -extern void StoreAttrDefault(Relation rel, AttrNumber attnum, Node *expr); +extern void StoreAttrDefault(Relation rel, AttrNumber attnum, + Node *expr, bool is_internal); extern Node *cookDefault(ParseState *pstate, Node *raw_default, @@ -108,6 +111,7 @@ extern Node *cookDefault(ParseState *pstate, extern void DeleteRelationTuple(Oid relid); extern void DeleteAttributeTuples(Oid relid); +extern void DeleteSystemAttributeTuples(Oid relid); extern void RemoveAttributeById(Oid relid, AttrNumber attnum); extern void RemoveAttrDefault(Oid relid, AttrNumber attnum, DropBehavior behavior, bool complain, bool internal); diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h index 7c8198f31e..006b1801a3 100644 --- a/src/include/catalog/index.h +++ b/src/include/catalog/index.h @@ -4,7 +4,7 @@ * prototypes for catalog/index.c. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/index.h @@ -27,6 +27,15 @@ typedef void (*IndexBuildCallback) (Relation index, bool tupleIsAlive, void *state); +/* Action code for index_set_state_flags */ +typedef enum +{ + INDEX_CREATE_SET_READY, + INDEX_CREATE_SET_VALID, + INDEX_DROP_CLEAR_VALID, + INDEX_DROP_SET_DEAD +} IndexStateFlagsAction; + extern void index_check_primary_key(Relation heapRel, IndexInfo *indexInfo, @@ -50,7 +59,8 @@ extern Oid index_create(Relation heapRelation, bool initdeferred, bool allow_system_table_mods, bool skip_build, - bool concurrent); + bool concurrent, + bool is_internal); extern void index_constraint_create(Relation heapRelation, Oid indexRelationId, @@ -61,7 +71,9 @@ extern void index_constraint_create(Relation heapRelation, bool initdeferred, bool mark_as_primary, bool update_pgindex, - bool allow_system_table_mods); + bool remove_old_dependencies, + bool allow_system_table_mods, + bool is_internal); extern void index_drop(Oid indexId, bool concurrent); @@ -88,6 +100,8 @@ extern double IndexBuildHeapScan(Relation heapRelation, extern void validate_index(Oid heapId, Oid indexId, Snapshot snapshot); +extern void index_set_state_flags(Oid indexId, IndexStateFlagsAction action); + extern void reindex_index(Oid indexId, bool skip_constraint_checks); /* Flag bits for reindex_relation(): */ diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h index 69bdd8443a..d013fce83b 100644 --- a/src/include/catalog/indexing.h +++ b/src/include/catalog/indexing.h @@ -5,7 +5,7 @@ * on system catalogs * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 2010-2012 Postgres-XC Development Group * @@ -107,6 +107,8 @@ DECLARE_UNIQUE_INDEX(pg_class_oid_index, 2662, on pg_class using btree(oid oid_o #define ClassOidIndexId 2662 DECLARE_UNIQUE_INDEX(pg_class_relname_nsp_index, 2663, on pg_class using btree(relname name_ops, relnamespace oid_ops)); #define ClassNameNspIndexId 2663 +DECLARE_INDEX(pg_class_tblspc_relfilenode_index, 3455, on pg_class using btree(reltablespace oid_ops, relfilenode oid_ops)); +#define ClassTblspcRelfilenodeIndexId 3455 DECLARE_UNIQUE_INDEX(pg_collation_name_enc_nsp_index, 3164, on pg_collation using btree(collname name_ops, collencoding int4_ops, collnamespace oid_ops)); #define CollationNameEncNspIndexId 3164 @@ -235,6 +237,11 @@ DECLARE_UNIQUE_INDEX(pg_trigger_tgrelid_tgname_index, 2701, on pg_trigger using DECLARE_UNIQUE_INDEX(pg_trigger_oid_index, 2702, on pg_trigger using btree(oid oid_ops)); #define TriggerOidIndexId 2702 +DECLARE_UNIQUE_INDEX(pg_event_trigger_evtname_index, 3467, on pg_event_trigger using btree(evtname name_ops)); +#define EventTriggerNameIndexId 3467 +DECLARE_UNIQUE_INDEX(pg_event_trigger_oid_index, 3468, on pg_event_trigger using btree(oid oid_ops)); +#define EventTriggerOidIndexId 3468 + DECLARE_UNIQUE_INDEX(pg_ts_config_cfgname_index, 3608, on pg_ts_config using btree(cfgname name_ops, cfgnamespace oid_ops)); #define TSConfigNameNspIndexId 3608 DECLARE_UNIQUE_INDEX(pg_ts_config_oid_index, 3712, on pg_ts_config using btree(oid oid_ops)); diff --git a/src/include/catalog/namespace.h b/src/include/catalog/namespace.h index 0c2d245e90..e45815b1d9 100644 --- a/src/include/catalog/namespace.h +++ b/src/include/catalog/namespace.h @@ -9,7 +9,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/namespace.h @@ -25,7 +25,7 @@ /* * This structure holds a list of possible functions or operators - * found by namespace lookup. Each function/operator is identified + * found by namespace lookup. Each function/operator is identified * by OID and by argument types; the list must be pruned by type * resolution rules that are embodied in the parser, not here. * See FuncnameGetCandidates's comments for more info. @@ -76,11 +76,13 @@ extern bool TypeIsVisible(Oid typid); extern FuncCandidateList FuncnameGetCandidates(List *names, int nargs, List *argnames, bool expand_variadic, - bool expand_defaults); + bool expand_defaults, + bool missing_ok); extern bool FunctionIsVisible(Oid funcid); extern Oid OpernameGetOprid(List *names, Oid oprleft, Oid oprright); -extern FuncCandidateList OpernameGetCandidates(List *names, char oprkind); +extern FuncCandidateList OpernameGetCandidates(List *names, char oprkind, + bool missing_schema_ok); extern bool OperatorIsVisible(Oid oprid); extern Oid OpclassnameGetOpcid(Oid amid, const char *opcname); @@ -111,7 +113,7 @@ extern void DeconstructQualifiedName(List *names, char **nspname_p, char **objname_p); extern Oid LookupNamespaceNoError(const char *nspname); -extern Oid LookupExplicitNamespace(const char *nspname); +extern Oid LookupExplicitNamespace(const char *nspname, bool missing_ok); extern Oid get_namespace_oid(const char *nspname, bool missing_ok); extern Oid LookupCreationNamespace(const char *nspname); @@ -136,12 +138,13 @@ extern void ForgetTempTableNamespace(void); extern OverrideSearchPath *GetOverrideSearchPath(MemoryContext context); extern OverrideSearchPath *CopyOverrideSearchPath(OverrideSearchPath *path); +extern bool OverrideSearchPathMatchesCurrent(OverrideSearchPath *path); extern void PushOverrideSearchPath(OverrideSearchPath *newpath); extern void PopOverrideSearchPath(void); extern Oid get_collation_oid(List *collname, bool missing_ok); extern Oid get_conversion_oid(List *conname, bool missing_ok); -extern Oid FindDefaultConversionProc(int4 for_encoding, int4 to_encoding); +extern Oid FindDefaultConversionProc(int32 for_encoding, int32 to_encoding); /* initialization & transaction cleanup code */ extern void InitializeSearchPath(void); diff --git a/src/include/catalog/objectaccess.h b/src/include/catalog/objectaccess.h index 3b40dbc492..4fdd0567ca 100644 --- a/src/include/catalog/objectaccess.h +++ b/src/include/catalog/objectaccess.h @@ -3,7 +3,7 @@ * * Object access hooks. * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California */ @@ -12,7 +12,7 @@ /* * Object access hooks are intended to be called just before or just after - * performing certain actions on a SQL object. This is intended as + * performing certain actions on a SQL object. This is intended as * infrastructure for security or logging pluggins. * * OAT_POST_CREATE should be invoked just after the object is created. @@ -22,15 +22,46 @@ * OAT_DROP should be invoked just before deletion of objects; typically * deleteOneObject(). Its arguments are packed within ObjectAccessDrop. * + * OAT_POST_ALTER should be invoked just after the object is altered, + * but before the command counter is incremented. An extension using the + * hook can use a current MVCC snapshot to get the old version of the tuple, + * and can use SnapshotSelf to get the new version of the tuple. + * + * OAT_NAMESPACE_SEARCH should be invoked prior to object name lookup under + * a particular namespace. This event is equivalent to usage permission + * on a schema under the default access control mechanism. + * + * OAT_FUNCTION_EXECUTE should be invoked prior to function execution. + * This event is almost equivalent to execute permission on functions, + * except for the case when execute permission is checked during object + * creation or altering, because OAT_POST_CREATE or OAT_POST_ALTER are + * sufficient for extensions to track these kind of checks. + * * Other types may be added in the future. */ typedef enum ObjectAccessType { OAT_POST_CREATE, OAT_DROP, + OAT_POST_ALTER, + OAT_NAMESPACE_SEARCH, + OAT_FUNCTION_EXECUTE } ObjectAccessType; /* + * Arguments of OAT_POST_CREATE event + */ +typedef struct +{ + /* + * This flag informs extensions whether the context of this creation is + * invoked by user's operations, or not. E.g, it shall be dealt as + * internal stuff on toast tables or indexes due to type changes. + */ + bool is_internal; +} ObjectAccessPostCreate; + +/* * Arguments of OAT_DROP event */ typedef struct @@ -43,21 +74,112 @@ typedef struct } ObjectAccessDrop; /* - * Hook, and a macro to invoke it. + * Arguments of OAT_POST_ALTER event + */ +typedef struct +{ + /* + * This identifier is used when system catalog takes two IDs to identify a + * particular tuple of the catalog. It is only used when the caller want + * to identify an entry of pg_inherits, pg_db_role_setting or + * pg_user_mapping. Elsewhere, InvalidOid should be set. + */ + Oid auxiliary_id; + + /* + * If this flag is set, the user hasn't requested that the object be + * altered, but we're doing it anyway for some internal reason. + * Permissions-checking hooks may want to skip checks if, say, we're alter + * the constraints of a temporary heap during CLUSTER. + */ + bool is_internal; +} ObjectAccessPostAlter; + +/* + * Arguments of OAT_NAMESPACE_SEARCH */ +typedef struct +{ + /* + * If true, hook should report an error when permission to search this + * schema is denied. + */ + bool ereport_on_violation; + + /* + * This is, in essence, an out parameter. Core code should initialize + * this to true, and any extension that wants to deny access should reset + * it to false. But an extension should be careful never to store a true + * value here, so that in case there are multiple extensions access is + * only allowed if all extensions agree. + */ + bool result; +} ObjectAccessNamespaceSearch; + +/* Plugin provides a hook function matching this signature. */ typedef void (*object_access_hook_type) (ObjectAccessType access, Oid classId, Oid objectId, int subId, void *arg); +/* Plugin sets this variable to a suitable hook function. */ extern PGDLLIMPORT object_access_hook_type object_access_hook; -#define InvokeObjectAccessHook(access,classId,objectId,subId,arg) \ +/* Core code uses these functions to call the hook (see macros below). */ +extern void RunObjectPostCreateHook(Oid classId, Oid objectId, int subId, + bool is_internal); +extern void RunObjectDropHook(Oid classId, Oid objectId, int subId, + int dropflags); +extern void RunObjectPostAlterHook(Oid classId, Oid objectId, int subId, + Oid auxiliaryId, bool is_internal); +extern bool RunNamespaceSearchHook(Oid objectId, bool ereport_on_volation); +extern void RunFunctionExecuteHook(Oid objectId); + +/* + * The following macros are wrappers around the functions above; these should + * normally be used to invoke the hook in lieu of calling the above functions + * directly. + */ + +#define InvokeObjectPostCreateHook(classId,objectId,subId) \ + InvokeObjectPostCreateHookArg((classId),(objectId),(subId),false) +#define InvokeObjectPostCreateHookArg(classId,objectId,subId,is_internal) \ do { \ if (object_access_hook) \ - (*object_access_hook)((access),(classId), \ - (objectId),(subId),(arg)); \ + RunObjectPostCreateHook((classId),(objectId),(subId), \ + (is_internal)); \ + } while(0) + +#define InvokeObjectDropHook(classId,objectId,subId) \ + InvokeObjectDropHookArg((classId),(objectId),(subId),0) +#define InvokeObjectDropHookArg(classId,objectId,subId,dropflags) \ + do { \ + if (object_access_hook) \ + RunObjectDropHook((classId),(objectId),(subId), \ + (dropflags)); \ + } while(0) + +#define InvokeObjectPostAlterHook(classId,objectId,subId) \ + InvokeObjectPostAlterHookArg((classId),(objectId),(subId), \ + InvalidOid,false) +#define InvokeObjectPostAlterHookArg(classId,objectId,subId, \ + auxiliaryId,is_internal) \ + do { \ + if (object_access_hook) \ + RunObjectPostAlterHook((classId),(objectId),(subId), \ + (auxiliaryId),(is_internal)); \ + } while(0) + +#define InvokeNamespaceSearchHook(objectId, ereport_on_violation) \ + (!object_access_hook \ + ? true \ + : RunNamespaceSearchHook((objectId), (ereport_on_violation))) + +#define InvokeFunctionExecuteHook(objectId) \ + do { \ + if (object_access_hook) \ + RunFunctionExecuteHook(objectId); \ } while(0) #endif /* OBJECTACCESS_H */ diff --git a/src/include/catalog/objectaddress.h b/src/include/catalog/objectaddress.h index 0af09c616d..2a9431d0d3 100644 --- a/src/include/catalog/objectaddress.h +++ b/src/include/catalog/objectaddress.h @@ -3,7 +3,7 @@ * objectaddress.h * functions for working with object addresses * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/objectaddress.h @@ -13,8 +13,9 @@ #ifndef OBJECTADDRESS_H #define OBJECTADDRESS_H -#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" #include "storage/lock.h" +#include "utils/acl.h" #include "utils/relcache.h" /* @@ -37,4 +38,24 @@ extern void check_object_ownership(Oid roleid, extern Oid get_object_namespace(const ObjectAddress *address); -#endif /* PARSE_OBJECT_H */ +extern bool is_objectclass_supported(Oid class_id); +extern Oid get_object_oid_index(Oid class_id); +extern int get_object_catcache_oid(Oid class_id); +extern int get_object_catcache_name(Oid class_id); +extern AttrNumber get_object_attnum_name(Oid class_id); +extern AttrNumber get_object_attnum_namespace(Oid class_id); +extern AttrNumber get_object_attnum_owner(Oid class_id); +extern AttrNumber get_object_attnum_acl(Oid class_id); +extern AclObjectKind get_object_aclkind(Oid class_id); +extern bool get_object_namensp_unique(Oid class_id); + +extern HeapTuple get_catalog_object_by_oid(Relation catalog, + Oid objectId); + +extern char *getObjectDescription(const ObjectAddress *object); +extern char *getObjectDescriptionOids(Oid classid, Oid objid); + +extern char *getObjectTypeDescription(const ObjectAddress *object); +extern char *getObjectIdentity(const ObjectAddress *address); + +#endif /* OBJECTADDRESS_H */ diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h index 7bf70e4ff8..a960bd9b29 100644 --- a/src/include/catalog/pg_aggregate.h +++ b/src/include/catalog/pg_aggregate.h @@ -10,7 +10,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_aggregate.h @@ -38,20 +38,31 @@ #endif * * aggfnoid pg_proc OID of the aggregate itself + * aggkind aggregate kind, see AGGKIND_ categories below + * aggnumdirectargs number of arguments that are "direct" arguments * aggtransfn transition function #ifdef PGXC * aggcollectfn collectition function #endif * aggfinalfn final function (0 if none) + * aggmtransfn forward function for moving-aggregate mode (0 if none) + * aggminvtransfn inverse function for moving-aggregate mode (0 if none) + * aggmfinalfn final function for moving-aggregate mode (0 if none) + * aggfinalextra true to pass extra dummy arguments to aggfinalfn + * aggmfinalextra true to pass extra dummy arguments to aggmfinalfn * aggsortop associated sort operator (0 if none) * aggtranstype type of aggregate's transition (state) data #ifdef PGXC * aggcollecttype type of aggregate's collection (state) data #endif + * aggtransspace estimated size of state data (0 for default estimate) + * aggmtranstype type of moving-aggregate state data (0 if none) + * aggmtransspace estimated size of moving-agg state (0 for default est) * agginitval initial value for transition state (can be NULL) #ifdef PGXC * agginitcollect initial value for collection state (can be NULL) #endif + * aggminitval initial value for moving-agg state (can be NULL) * ---------------------------------------------------------------- */ #define AggregateRelationId 2600 @@ -59,16 +70,27 @@ CATALOG(pg_aggregate,2600) BKI_WITHOUT_OIDS { regproc aggfnoid; + char aggkind; + int16 aggnumdirectargs; regproc aggtransfn; regproc aggcollectfn; /* PGXC */ regproc aggfinalfn; + regproc aggmtransfn; + regproc aggminvtransfn; + regproc aggmfinalfn; + bool aggfinalextra; + bool aggmfinalextra; Oid aggsortop; Oid aggtranstype; Oid aggcollecttype; /* PGXC */ + int32 aggtransspace; + Oid aggmtranstype; + int32 aggmtransspace; #ifdef CATALOG_VARLEN /* variable-length fields start here */ text agginitval; text agginitcollect; /* PGXC, VARIABLE LENGTH FIELD */ + text aggminitval; #endif } FormData_pg_aggregate; @@ -84,27 +106,42 @@ typedef FormData_pg_aggregate *Form_pg_aggregate; * ---------------- */ -#ifdef PGXC -#define Natts_pg_aggregate 9 +#define Natts_pg_aggregate 20 #define Anum_pg_aggregate_aggfnoid 1 -#define Anum_pg_aggregate_aggtransfn 2 -#define Anum_pg_aggregate_aggcollectfn 3 -#define Anum_pg_aggregate_aggfinalfn 4 -#define Anum_pg_aggregate_aggsortop 5 -#define Anum_pg_aggregate_aggtranstype 6 -#define Anum_pg_aggregate_aggcollecttype 7 -#define Anum_pg_aggregate_agginitval 8 -#define Anum_pg_aggregate_agginitcollect 9 -#endif -#ifdef PGXC -//#define Natts_pg_aggregate 6 -//#define Anum_pg_aggregate_aggfnoid 1 -//#define Anum_pg_aggregate_aggtransfn 2 -//#define Anum_pg_aggregate_aggfinalfn 3 -//#define Anum_pg_aggregate_aggsortop 4 -//#define Anum_pg_aggregate_aggtranstype 5 -//#define Anum_pg_aggregate_agginitval 6 -#endif +#define Anum_pg_aggregate_aggkind 2 +#define Anum_pg_aggregate_aggnumdirectargs 3 +#define Anum_pg_aggregate_aggtransfn 4 +#define Anum_pg_aggregate_aggcollectfn 5 +#define Anum_pg_aggregate_aggfinalfn 6 +#define Anum_pg_aggregate_aggmtransfn 7 +#define Anum_pg_aggregate_aggminvtransfn 8 +#define Anum_pg_aggregate_aggmfinalfn 9 +#define Anum_pg_aggregate_aggfinalextra 10 +#define Anum_pg_aggregate_aggmfinalextra 11 +#define Anum_pg_aggregate_aggsortop 12 +#define Anum_pg_aggregate_aggtranstype 13 +#define Anum_pg_aggregate_aggcollecttype 14 +#define Anum_pg_aggregate_aggtransspace 15 +#define Anum_pg_aggregate_aggmtranstype 16 +#define Anum_pg_aggregate_aggmtransspace 17 +#define Anum_pg_aggregate_agginitval 18 +#define Anum_pg_aggregate_agginitcollect 19 +#define Anum_pg_aggregate_aggminitval 20 + +/* + * Symbolic values for aggkind column. We distinguish normal aggregates + * from ordered-set aggregates (which have two sets of arguments, namely + * direct and aggregated arguments) and from hypothetical-set aggregates + * (which are a subclass of ordered-set aggregates in which the last + * direct arguments have to match up in number and datatypes with the + * aggregated arguments). + */ +#define AGGKIND_NORMAL 'n' +#define AGGKIND_ORDERED_SET 'o' +#define AGGKIND_HYPOTHETICAL 'h' + +/* Use this macro to test for "ordered-set agg including hypothetical case" */ +#define AGGKIND_IS_ORDERED_SET(kind) ((kind) != AGGKIND_NORMAL) /* ---------------- @@ -113,379 +150,215 @@ typedef FormData_pg_aggregate *Form_pg_aggregate; */ /* avg */ -#ifdef PGXC -DATA(insert ( 2100 int8_avg_accum numeric_avg_collect numeric_avg 0 1231 1231 "{0,0}" "{0,0}" )); -DATA(insert ( 2101 int4_avg_accum int8_avg_collect int8_avg 0 1016 1016 "{0,0}" "{0,0}" )); -DATA(insert ( 2102 int2_avg_accum int8_avg_collect int8_avg 0 1016 1016 "{0,0}" "{0,0}" )); -DATA(insert ( 2103 numeric_avg_accum numeric_avg_collect numeric_avg 0 1231 1231 "{0,0}" "{0,0}" )); -DATA(insert ( 2104 float4_accum float8_collect float8_avg 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2105 float8_accum float8_collect float8_avg 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2106 interval_accum interval_collect interval_avg 0 1187 1187 "{0 second,0 second}" "{0 second,0 second}" )); -#endif -#ifdef PGXC -//DATA(insert ( 2100 int8_avg_accum numeric_avg 0 1231 "{0,0}" )); -//DATA(insert ( 2101 int4_avg_accum int8_avg 0 1016 "{0,0}" )); -//DATA(insert ( 2102 int2_avg_accum int8_avg 0 1016 "{0,0}" )); -//DATA(insert ( 2103 numeric_avg_accum numeric_avg 0 1231 "{0,0}" )); -//DATA(insert ( 2104 float4_accum float8_avg 0 1022 "{0,0,0}" )); -//DATA(insert ( 2105 float8_accum float8_avg 0 1022 "{0,0,0}" )); -//DATA(insert ( 2106 interval_accum interval_avg 0 1187 "{0 second,0 second}" )); -#endif +DATA(insert ( 2100 n 0 int8_avg_accum numeric_avg_collect numeric_avg int8_avg_accum int8_accum_inv numeric_avg f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2101 n 0 int4_avg_accum int8_avg_collect int8_avg int4_avg_accum int4_avg_accum_inv int8_avg f f 0 1016 1016 0 1016 0 "{0,0}" "{0,0}" "{0,0}" )); +DATA(insert ( 2102 n 0 int2_avg_accum int8_avg_collect int8_avg int2_avg_accum int2_avg_accum_inv int8_avg f f 0 1016 1016 0 1016 0 "{0,0}" "{0,0}" "{0,0}" )); +DATA(insert ( 2103 n 0 numeric_avg_accum numeric_avg_collect numeric_avg numeric_avg_accum numeric_accum_inv numeric_avg f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2104 n 0 float4_accum float8_collect float8_avg - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2105 n 0 float8_accum float8_collect float8_avg - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2106 n 0 interval_accum interval_collect interval_avg interval_accum interval_accum_inv interval_avg f f 0 1187 1187 0 1187 0 "{0 second,0 second}" "{0 second,0 second}" "{0 second,0 second}" )); /* sum */ -#ifdef PGXC -DATA(insert ( 2107 int8_sum numeric_add - 0 1700 1700 _null_ _null_ )); -DATA(insert ( 2108 int4_sum int8_sum_to_int8 - 0 20 20 _null_ _null_ )); -DATA(insert ( 2109 int2_sum int8_sum_to_int8 - 0 20 20 _null_ _null_ )); -DATA(insert ( 2110 float4pl float4pl - 0 700 700 _null_ _null_ )); -DATA(insert ( 2111 float8pl float8pl - 0 701 701 _null_ _null_ )); -DATA(insert ( 2112 cash_pl cash_pl - 0 790 790 _null_ _null_ )); -DATA(insert ( 2113 interval_pl interval_pl - 0 1186 1186 _null_ _null_ )); -DATA(insert ( 2114 numeric_add numeric_add - 0 1700 1700 _null_ _null_ )); -#endif -#ifdef PGXC -//DATA(insert ( 2107 int8_sum - 0 1700 _null_ )); -//DATA(insert ( 2108 int4_sum - 0 20 _null_ )); -//DATA(insert ( 2109 int2_sum - 0 20 _null_ )); -//DATA(insert ( 2110 float4pl - 0 700 _null_ )); -//DATA(insert ( 2111 float8pl - 0 701 _null_ )); -//DATA(insert ( 2112 cash_pl - 0 790 _null_ )); -//DATA(insert ( 2113 interval_pl - 0 1186 _null_ )); -//DATA(insert ( 2114 numeric_add - 0 1700 _null_ )); -#endif +DATA(insert ( 2107 n 0 int8_avg_accum numeric_add numeric_sum int8_avg_accum int8_accum_inv numeric_sum f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2108 n 0 int4_sum int8_sum_to_int8 - int4_avg_accum int4_avg_accum_inv int2int4_sum f f 0 20 20 0 1016 0 _null_ _null_ "{0,0}" )); +DATA(insert ( 2109 n 0 int2_sum int8_sum_to_int8 - int2_avg_accum int2_avg_accum_inv int2int4_sum f f 0 20 20 0 1016 0 _null_ _null_ "{0,0}" )); +DATA(insert ( 2110 n 0 float4pl float4pl - - - - f f 0 700 700 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2111 n 0 float8pl float8pl - - - - f f 0 701 701 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2112 n 0 cash_pl cash_pl - cash_pl cash_mi - f f 0 790 0 790 790 0 _null_ _null_ _null_ )); +DATA(insert ( 2113 n 0 interval_pl interval_pl - interval_pl interval_mi - f f 0 1186 1186 0 1186 0 _null_ _null_ _null_ )); +DATA(insert ( 2114 n 0 numeric_avg_accum numeric_add numeric_sum numeric_avg_accum numeric_accum_inv numeric_sum f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); /* max */ -#ifdef PGXC -DATA(insert ( 2115 int8larger int8larger - 413 20 20 _null_ _null_ )); -DATA(insert ( 2116 int4larger int4larger - 521 23 23 _null_ _null_ )); -DATA(insert ( 2117 int2larger int2larger - 520 21 21 _null_ _null_ )); -DATA(insert ( 2118 oidlarger oidlarger - 610 26 26 _null_ _null_ )); -DATA(insert ( 2119 float4larger float4larger - 623 700 700 _null_ _null_ )); -DATA(insert ( 2120 float8larger float8larger - 674 701 701 _null_ _null_ )); -DATA(insert ( 2121 int4larger int4larger - 563 702 702 _null_ _null_ )); -DATA(insert ( 2122 date_larger date_larger - 1097 1082 1082 _null_ _null_ )); -DATA(insert ( 2123 time_larger time_larger - 1112 1083 1083 _null_ _null_ )); -DATA(insert ( 2124 timetz_larger timetz_larger - 1554 1266 1266 _null_ _null_ )); -DATA(insert ( 2125 cashlarger cashlarger - 903 790 790 _null_ _null_ )); -DATA(insert ( 2126 timestamp_larger timestamp_larger - 2064 1114 1114 _null_ _null_ )); -DATA(insert ( 2127 timestamptz_larger timestamptz_larger - 1324 1184 1184 _null_ _null_ )); -DATA(insert ( 2128 interval_larger interval_larger - 1334 1186 1186 _null_ _null_ )); -DATA(insert ( 2129 text_larger text_larger - 666 25 25 _null_ _null_ )); -DATA(insert ( 2130 numeric_larger numeric_larger - 1756 1700 1700 _null_ _null_ )); -DATA(insert ( 2050 array_larger array_larger - 1073 2277 2277 _null_ _null_ )); -DATA(insert ( 2244 bpchar_larger bpchar_larger - 1060 1042 1042 _null_ _null_ )); -DATA(insert ( 2797 tidlarger tidlarger - 2800 27 27 _null_ _null_ )); -DATA(insert ( 3526 enum_larger enum_larger - 3519 3500 3500 _null_ _null_ )); -#endif -#ifdef PGXC -//DATA(insert ( 2115 int8larger - 413 20 _null_ )); -//DATA(insert ( 2116 int4larger - 521 23 _null_ )); -//DATA(insert ( 2117 int2larger - 520 21 _null_ )); -//DATA(insert ( 2118 oidlarger - 610 26 _null_ )); -//DATA(insert ( 2119 float4larger - 623 700 _null_ )); -//DATA(insert ( 2120 float8larger - 674 701 _null_ )); -//DATA(insert ( 2121 int4larger - 563 702 _null_ )); -//DATA(insert ( 2122 date_larger - 1097 1082 _null_ )); -//DATA(insert ( 2123 time_larger - 1112 1083 _null_ )); -//DATA(insert ( 2124 timetz_larger - 1554 1266 _null_ )); -//DATA(insert ( 2125 cashlarger - 903 790 _null_ )); -//DATA(insert ( 2126 timestamp_larger - 2064 1114 _null_ )); -//DATA(insert ( 2127 timestamptz_larger - 1324 1184 _null_ )); -//DATA(insert ( 2128 interval_larger - 1334 1186 _null_ )); -//DATA(insert ( 2129 text_larger - 666 25 _null_ )); -//DATA(insert ( 2130 numeric_larger - 1756 1700 _null_ )); -//DATA(insert ( 2050 array_larger - 1073 2277 _null_ )); -//DATA(insert ( 2244 bpchar_larger - 1060 1042 _null_ )); -//DATA(insert ( 2797 tidlarger - 2800 27 _null_ )); -//DATA(insert ( 3526 enum_larger - 3519 3500 _null_ )); -#endif +DATA(insert ( 2115 n 0 int8larger int8larger - - - - f f 413 20 20 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2116 n 0 int4larger int4larger - - - - f f 521 23 23 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2117 n 0 int2larger int2larger - - - - f f 520 21 21 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2118 n 0 oidlarger oidlarger - - - - f f 610 26 26 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2119 n 0 float4larger float4larger - - - - f f 623 700 700 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2120 n 0 float8larger float8larger - - - - f f 674 701 701 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2121 n 0 int4larger int4larger - - - - f f 563 702 702 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2122 n 0 date_larger date_larger - - - - f f 1097 1082 1082 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2123 n 0 time_larger time_larger - - - - f f 1112 1083 1083 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2124 n 0 timetz_larger timetz_larger - - - - f f 1554 1266 1266 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2125 n 0 cashlarger cashlarger - - - - f f 903 790 790 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2126 n 0 timestamp_larger timestamp_larger - - - - f f 2064 1114 1114 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2127 n 0 timestamptz_larger timestamptz_larger - - - - f f 1324 1184 1184 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2128 n 0 interval_larger interval_larger - - - - f f 1334 1186 1186 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2129 n 0 text_larger text_larger - - - - f f 666 25 25 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2130 n 0 numeric_larger numeric_larger - - - - f f 1756 1700 1700 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2050 n 0 array_larger array_larger - - - - f f 1073 2277 2277 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2244 n 0 bpchar_larger bpchar_larger - - - - f f 1060 1042 1042 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2797 n 0 tidlarger tidlarger - - - - f f 2800 27 27 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3526 n 0 enum_larger enum_larger - - - - f f 3519 3500 3500 0 0 0 _null_ _null_ _null_ )); /* min */ -#ifdef PGXC -DATA(insert ( 2131 int8smaller int8smaller - 412 20 20 _null_ _null_ )); -DATA(insert ( 2132 int4smaller int4smaller - 97 23 23 _null_ _null_ )); -DATA(insert ( 2133 int2smaller int2smaller - 95 21 21 _null_ _null_ )); -DATA(insert ( 2134 oidsmaller oidsmaller - 609 26 26 _null_ _null_ )); -DATA(insert ( 2135 float4smaller float4smaller - 622 700 700 _null_ _null_ )); -DATA(insert ( 2136 float8smaller float8smaller - 672 701 701 _null_ _null_ )); -DATA(insert ( 2137 int4smaller int4smaller - 562 702 702 _null_ _null_ )); -DATA(insert ( 2138 date_smaller date_smaller - 1095 1082 1082 _null_ _null_ )); -DATA(insert ( 2139 time_smaller time_smaller - 1110 1083 1083 _null_ _null_ )); -DATA(insert ( 2140 timetz_smaller timetz_smaller - 1552 1266 1266 _null_ _null_ )); -DATA(insert ( 2141 cashsmaller cashsmaller - 902 790 790 _null_ _null_ )); -DATA(insert ( 2142 timestamp_smaller timestamp_smaller - 2062 1114 1114 _null_ _null_ )); -DATA(insert ( 2143 timestamptz_smaller timestamptz_smaller - 1322 1184 1184 _null_ _null_ )); -DATA(insert ( 2144 interval_smaller interval_smaller - 1332 1186 1186 _null_ _null_ )); -DATA(insert ( 2145 text_smaller text_smaller - 664 25 25 _null_ _null_ )); -DATA(insert ( 2146 numeric_smaller numeric_smaller - 1754 1700 1700 _null_ _null_ )); -DATA(insert ( 2051 array_smaller array_smaller - 1072 2277 2277 _null_ _null_ )); -DATA(insert ( 2245 bpchar_smaller bpchar_smaller - 1058 1042 1042 _null_ _null_ )); -DATA(insert ( 2798 tidsmaller tidsmaller - 2799 27 27 _null_ _null_ )); -DATA(insert ( 3527 enum_smaller enum_smaller - 3518 3500 3500 _null_ _null_ )); -#endif -#ifdef PGXC -//DATA(insert ( 2131 int8smaller - 412 20 _null_ )); -//DATA(insert ( 2132 int4smaller - 97 23 _null_ )); -//DATA(insert ( 2133 int2smaller - 95 21 _null_ )); -//DATA(insert ( 2134 oidsmaller - 609 26 _null_ )); -//DATA(insert ( 2135 float4smaller - 622 700 _null_ )); -//DATA(insert ( 2136 float8smaller - 672 701 _null_ )); -//DATA(insert ( 2137 int4smaller - 562 702 _null_ )); -//DATA(insert ( 2138 date_smaller - 1095 1082 _null_ )); -//DATA(insert ( 2139 time_smaller - 1110 1083 _null_ )); -//DATA(insert ( 2140 timetz_smaller - 1552 1266 _null_ )); -//DATA(insert ( 2141 cashsmaller - 902 790 _null_ )); -//DATA(insert ( 2142 timestamp_smaller - 2062 1114 _null_ )); -//DATA(insert ( 2143 timestamptz_smaller - 1322 1184 _null_ )); -//DATA(insert ( 2144 interval_smaller - 1332 1186 _null_ )); -//DATA(insert ( 2145 text_smaller - 664 25 _null_ )); -//DATA(insert ( 2146 numeric_smaller - 1754 1700 _null_ )); -//DATA(insert ( 2051 array_smaller - 1072 2277 _null_ )); -//DATA(insert ( 2245 bpchar_smaller - 1058 1042 _null_ )); -//DATA(insert ( 2798 tidsmaller - 2799 27 _null_ )); -//DATA(insert ( 3527 enum_smaller - 3518 3500 _null_ )); -#endif +DATA(insert ( 2131 n 0 int8smaller int8smaller - - - - f f 412 20 20 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2132 n 0 int4smaller int4smaller - - - - f f 97 23 23 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2133 n 0 int2smaller int2smaller - - - - f f 95 21 21 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2134 n 0 oidsmaller oidsmaller - - - - f f 609 26 26 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2135 n 0 float4smaller float4smaller - - - - f f 622 700 700 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2136 n 0 float8smaller float8smaller - - - - f f 672 701 701 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2137 n 0 int4smaller int4smaller - - - - f f 562 702 702 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2138 n 0 date_smaller date_smaller - - - - f f 1095 1082 1082 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2139 n 0 time_smaller time_smaller - - - - f f 1110 1083 1083 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2140 n 0 timetz_smaller timetz_smaller - - - - f f 1552 1266 1266 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2141 n 0 cashsmaller cashsmaller - - - - f f 902 790 790 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2142 n 0 timestamp_smaller timestamp_smaller - - - - f f 2062 1114 1114 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2143 n 0 timestamptz_smaller timestamptz_smaller - - - - f f 1322 1184 1184 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2144 n 0 interval_smaller interval_smaller - - - - f f 1332 1186 1186 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2145 n 0 text_smaller text_smaller - - - - f f 664 25 25 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2146 n 0 numeric_smaller numeric_smaller - - - - f f 1754 1700 1700 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2051 n 0 array_smaller array_smaller - - - - f f 1072 2277 2277 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2245 n 0 bpchar_smaller bpchar_smaller - - - - f f 1058 1042 1042 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2798 n 0 tidsmaller tidsmaller - - - - f f 2799 27 27 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3527 n 0 enum_smaller enum_smaller - - - - f f 3518 3500 3500 0 0 0 _null_ _null_ _null_ )); /* count */ -/* Final function is data type conversion function numeric_int8 is referenced by OID because of ambiguous definition in pg_proc */ -#ifdef PGXC -DATA(insert ( 2147 int8inc_any int8_sum_to_int8 - 0 20 20 "0" _null_ )); -DATA(insert ( 2803 int8inc int8_sum_to_int8 - 0 20 20 "0" _null_ )); -#endif -#ifdef PGXC -//DATA(insert ( 2147 int8inc_any - 0 20 "0" )); -//DATA(insert ( 2803 int8inc - 0 20 "0" )); -#endif +DATA(insert ( 2147 n 0 int8inc_any int8_sum_to_int8 - int8inc_any int8dec_any - f f 0 20 20 0 20 0 "0" _null_ "0" )); +DATA(insert ( 2803 n 0 int8inc int8_sum_to_int8 - int8inc int8dec - f f 0 20 20 0 20 0 "0" _null_ "0" )); /* var_pop */ -#ifdef PGXC -DATA(insert ( 2718 int8_accum numeric_collect numeric_var_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2719 int4_accum numeric_collect numeric_var_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2720 int2_accum numeric_collect numeric_var_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2721 float4_accum float8_collect float8_var_pop 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2722 float8_accum float8_collect float8_var_pop 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2723 numeric_accum numeric_collect numeric_var_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -#endif -#ifdef PGXC -//DATA(insert ( 2718 int8_accum numeric_var_pop 0 1231 "{0,0,0}" )); -//DATA(insert ( 2719 int4_accum numeric_var_pop 0 1231 "{0,0,0}" )); -//DATA(insert ( 2720 int2_accum numeric_var_pop 0 1231 "{0,0,0}" )); -//DATA(insert ( 2721 float4_accum float8_var_pop 0 1022 "{0,0,0}" )); -//DATA(insert ( 2722 float8_accum float8_var_pop 0 1022 "{0,0,0}" )); -//DATA(insert ( 2723 numeric_accum numeric_var_pop 0 1231 "{0,0,0}" )); -#endif +DATA(insert ( 2718 n 0 int8_accum numeric_collect numeric_var_pop int8_accum int8_accum_inv numeric_var_pop f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2719 n 0 int4_accum numeric_collect numeric_var_pop int4_accum int4_accum_inv numeric_var_pop f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2720 n 0 int2_accum numeric_collect numeric_var_pop int2_accum int2_accum_inv numeric_var_pop f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2721 n 0 float4_accum float8_collect float8_var_pop - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2722 n 0 float8_accum float8_collect float8_var_pop - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2723 n 0 numeric_accum numeric_collect numeric_var_pop numeric_accum numeric_accum_inv numeric_var_pop f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); /* var_samp */ -#ifdef PGXC -DATA(insert ( 2641 int8_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2642 int4_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2643 int2_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2644 float4_accum float8_collect float8_var_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2645 float8_accum float8_collect float8_var_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2646 numeric_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -#endif -#ifdef PGXC -//DATA(insert ( 2641 int8_accum numeric_var_samp 0 1231 "{0,0,0}" )); -//DATA(insert ( 2642 int4_accum numeric_var_samp 0 1231 "{0,0,0}" )); -//DATA(insert ( 2643 int2_accum numeric_var_samp 0 1231 "{0,0,0}" )); -//DATA(insert ( 2644 float4_accum float8_var_samp 0 1022 "{0,0,0}" )); -//DATA(insert ( 2645 float8_accum float8_var_samp 0 1022 "{0,0,0}" )); -//DATA(insert ( 2646 numeric_accum numeric_var_samp 0 1231 "{0,0,0}" )); -#endif +DATA(insert ( 2641 n 0 int8_accum numeric_collect numeric_var_samp int8_accum int8_accum_inv numeric_var_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2642 n 0 int4_accum numeric_collect numeric_var_samp int4_accum int4_accum_inv numeric_var_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2643 n 0 int2_accum numeric_collect numeric_var_samp int2_accum int2_accum_inv numeric_var_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2644 n 0 float4_accum float8_collect float8_var_samp - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2645 n 0 float8_accum float8_collect float8_var_samp - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2646 n 0 numeric_accum numeric_collect numeric_var_samp numeric_accum numeric_accum_inv numeric_var_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); /* variance: historical Postgres syntax for var_samp */ -#ifdef PGXC -DATA(insert ( 2148 int8_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2149 int4_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2150 int2_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2151 float4_accum float8_collect float8_var_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2152 float8_accum float8_collect float8_var_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2153 numeric_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -#endif -#ifdef PGXC -//DATA(insert ( 2148 int8_accum numeric_var_samp 0 1231 "{0,0,0}" )); -//DATA(insert ( 2149 int4_accum numeric_var_samp 0 1231 "{0,0,0}" )); -//DATA(insert ( 2150 int2_accum numeric_var_samp 0 1231 "{0,0,0}" )); -//DATA(insert ( 2151 float4_accum float8_var_samp 0 1022 "{0,0,0}" )); -//DATA(insert ( 2152 float8_accum float8_var_samp 0 1022 "{0,0,0}" )); -//DATA(insert ( 2153 numeric_accum numeric_var_samp 0 1231 "{0,0,0}" )); -#endif +DATA(insert ( 2148 n 0 int8_accum numeric_collect numeric_var_samp int8_accum int8_accum_inv numeric_var_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2149 n 0 int4_accum numeric_collect numeric_var_samp int4_accum int4_accum_inv numeric_var_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2150 n 0 int2_accum numeric_collect numeric_var_samp int2_accum int2_accum_inv numeric_var_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2151 n 0 float4_accum float8_collect float8_var_samp - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2152 n 0 float8_accum float8_collect float8_var_samp - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2153 n 0 numeric_accum numeric_collect numeric_var_samp numeric_accum numeric_accum_inv numeric_var_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); /* stddev_pop */ -#ifdef PGXC -DATA(insert ( 2724 int8_accum numeric_collect numeric_stddev_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2725 int4_accum numeric_collect numeric_stddev_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2726 int2_accum numeric_collect numeric_stddev_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2727 float4_accum float8_collect float8_stddev_pop 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2728 float8_accum float8_collect float8_stddev_pop 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2729 numeric_accum numeric_collect numeric_stddev_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -#endif -#ifdef PGXC -//DATA(insert ( 2724 int8_accum numeric_stddev_pop 0 1231 "{0,0,0}" )); -//DATA(insert ( 2725 int4_accum numeric_stddev_pop 0 1231 "{0,0,0}" )); -//DATA(insert ( 2726 int2_accum numeric_stddev_pop 0 1231 "{0,0,0}" )); -//DATA(insert ( 2727 float4_accum float8_stddev_pop 0 1022 "{0,0,0}" )); -//DATA(insert ( 2728 float8_accum float8_stddev_pop 0 1022 "{0,0,0}" )); -//DATA(insert ( 2729 numeric_accum numeric_stddev_pop 0 1231 "{0,0,0}" )); -#endif +DATA(insert ( 2724 n 0 int8_accum numeric_collect numeric_stddev_pop int8_accum int8_accum_inv numeric_stddev_pop f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2725 n 0 int4_accum numeric_collect numeric_stddev_pop int4_accum int4_accum_inv numeric_stddev_pop f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2726 n 0 int2_accum numeric_collect numeric_stddev_pop int2_accum int2_accum_inv numeric_stddev_pop f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2727 n 0 float4_accum float8_collect float8_stddev_pop - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2728 n 0 float8_accum float8_collect float8_stddev_pop - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2729 n 0 numeric_accum numeric_collect numeric_stddev_pop numeric_accum numeric_accum_inv numeric_stddev_pop f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); /* stddev_samp */ -#ifdef PGXC -DATA(insert ( 2712 int8_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2713 int4_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2714 int2_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2715 float4_accum float8_collect float8_stddev_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2716 float8_accum float8_collect float8_stddev_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2717 numeric_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -#endif -#ifdef PGXC -//DATA(insert ( 2712 int8_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); -//DATA(insert ( 2713 int4_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); -//DATA(insert ( 2714 int2_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); -//DATA(insert ( 2715 float4_accum float8_stddev_samp 0 1022 "{0,0,0}" )); -//DATA(insert ( 2716 float8_accum float8_stddev_samp 0 1022 "{0,0,0}" )); -//DATA(insert ( 2717 numeric_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); -#endif +DATA(insert ( 2712 n 0 int8_accum numeric_collect numeric_stddev_samp int8_accum int8_accum_inv numeric_stddev_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2713 n 0 int4_accum numeric_collect numeric_stddev_samp int4_accum int4_accum_inv numeric_stddev_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2714 n 0 int2_accum numeric_collect numeric_stddev_samp int2_accum int2_accum_inv numeric_stddev_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2715 n 0 float4_accum float8_collect float8_stddev_samp - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2716 n 0 float8_accum float8_collect float8_stddev_samp - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2717 n 0 numeric_accum numeric_collect numeric_stddev_samp numeric_accum numeric_accum_inv numeric_stddev_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); /* stddev: historical Postgres syntax for stddev_samp */ -#ifdef PGXC -DATA(insert ( 2154 int8_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2155 int4_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2156 int2_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2157 float4_accum float8_collect float8_stddev_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2158 float8_accum float8_collect float8_stddev_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2159 numeric_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -#endif -#ifdef PGXC -//DATA(insert ( 2154 int8_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); -//DATA(insert ( 2155 int4_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); -//DATA(insert ( 2156 int2_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); -//DATA(insert ( 2157 float4_accum float8_stddev_samp 0 1022 "{0,0,0}" )); -//DATA(insert ( 2158 float8_accum float8_stddev_samp 0 1022 "{0,0,0}" )); -//DATA(insert ( 2159 numeric_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); -#endif +DATA(insert ( 2154 n 0 int8_accum numeric_collect numeric_stddev_samp int8_accum int8_accum_inv numeric_stddev_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2155 n 0 int4_accum numeric_collect numeric_stddev_samp int4_accum int4_accum_inv numeric_stddev_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2156 n 0 int2_accum numeric_collect numeric_stddev_samp int2_accum int2_accum_inv numeric_stddev_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); +DATA(insert ( 2157 n 0 float4_accum float8_collect float8_stddev_samp - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2158 n 0 float8_accum float8_collect float8_stddev_samp - - - f f 0 1022 1022 0 0 0 "{0,0,0}" "{0,0,0}" _null_ )); +DATA(insert ( 2159 n 0 numeric_accum numeric_collect numeric_stddev_samp numeric_accum numeric_accum_inv numeric_stddev_samp f f 0 2281 2281 128 2281 128 _null_ _null_ _null_ )); /* SQL2003 binary regression aggregates */ -#ifdef PGXC -DATA(insert ( 2818 int8inc_float8_float8 int8_sum_to_int8 - 0 20 20 "0" _null_ )); -DATA(insert ( 2819 float8_regr_accum float8_regr_collect float8_regr_sxx 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2820 float8_regr_accum float8_regr_collect float8_regr_syy 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2821 float8_regr_accum float8_regr_collect float8_regr_sxy 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2822 float8_regr_accum float8_regr_collect float8_regr_avgx 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2823 float8_regr_accum float8_regr_collect float8_regr_avgy 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2824 float8_regr_accum float8_regr_collect float8_regr_r2 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2825 float8_regr_accum float8_regr_collect float8_regr_slope 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2826 float8_regr_accum float8_regr_collect float8_regr_intercept 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2827 float8_regr_accum float8_regr_collect float8_covar_pop 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2828 float8_regr_accum float8_regr_collect float8_covar_samp 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2829 float8_regr_accum float8_regr_collect float8_corr 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -#endif -#ifdef PGXC -//DATA(insert ( 2818 int8inc_float8_float8 - 0 20 "0" )); -//DATA(insert ( 2819 float8_regr_accum float8_regr_sxx 0 1022 "{0,0,0,0,0,0}" )); -//DATA(insert ( 2820 float8_regr_accum float8_regr_syy 0 1022 "{0,0,0,0,0,0}" )); -//DATA(insert ( 2821 float8_regr_accum float8_regr_sxy 0 1022 "{0,0,0,0,0,0}" )); -//DATA(insert ( 2822 float8_regr_accum float8_regr_avgx 0 1022 "{0,0,0,0,0,0}" )); -//DATA(insert ( 2823 float8_regr_accum float8_regr_avgy 0 1022 "{0,0,0,0,0,0}" )); -//DATA(insert ( 2824 float8_regr_accum float8_regr_r2 0 1022 "{0,0,0,0,0,0}" )); -//DATA(insert ( 2825 float8_regr_accum float8_regr_slope 0 1022 "{0,0,0,0,0,0}" )); -//DATA(insert ( 2826 float8_regr_accum float8_regr_intercept 0 1022 "{0,0,0,0,0,0}" )); -//DATA(insert ( 2827 float8_regr_accum float8_covar_pop 0 1022 "{0,0,0,0,0,0}" )); -//DATA(insert ( 2828 float8_regr_accum float8_covar_samp 0 1022 "{0,0,0,0,0,0}" )); -//DATA(insert ( 2829 float8_regr_accum float8_corr 0 1022 "{0,0,0,0,0,0}" )); -#endif +DATA(insert ( 2818 n 0 int8inc_float8_float8 int8_sum_to_int8 - - - - f f 0 20 20 0 0 0 "0" _null_ _null_ )); +DATA(insert ( 2819 n 0 float8_regr_accum float8_regr_collect float8_regr_sxx - - - f f 0 1022 1022 0 0 0 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" _null_ )); +DATA(insert ( 2820 n 0 float8_regr_accum float8_regr_collect float8_regr_syy - - - f f 0 1022 1022 0 0 0 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" _null_ )); +DATA(insert ( 2821 n 0 float8_regr_accum float8_regr_collect float8_regr_sxy - - - f f 0 1022 1022 0 0 0 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" _null_ )); +DATA(insert ( 2822 n 0 float8_regr_accum float8_regr_collect float8_regr_avgx - - - f f 0 1022 1022 0 0 0 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" _null_ )); +DATA(insert ( 2823 n 0 float8_regr_accum float8_regr_collect float8_regr_avgy - - - f f 0 1022 1022 0 0 0 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" _null_ )); +DATA(insert ( 2824 n 0 float8_regr_accum float8_regr_collect float8_regr_r2 - - - f f 0 1022 1022 0 0 0 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" _null_ )); +DATA(insert ( 2825 n 0 float8_regr_accum float8_regr_collect float8_regr_slope - - - f f 0 1022 1022 0 0 0 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" _null_ )); +DATA(insert ( 2826 n 0 float8_regr_accum float8_regr_collect float8_regr_intercept - - - f f 0 1022 1022 0 0 0 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" _null_ )); +DATA(insert ( 2827 n 0 float8_regr_accum float8_regr_collect float8_covar_pop - - - f f 0 1022 1022 0 0 0 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" _null_ )); +DATA(insert ( 2828 n 0 float8_regr_accum float8_regr_collect float8_covar_samp - - - f f 0 1022 1022 0 0 0 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" _null_ )); +DATA(insert ( 2829 n 0 float8_regr_accum float8_regr_collect float8_corr - - - f f 0 1022 1022 0 0 0 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" _null_ )); /* boolean-and and boolean-or */ -#ifdef PGXC -DATA(insert ( 2517 booland_statefunc booland_statefunc - 58 16 16 _null_ _null_ )); -DATA(insert ( 2518 boolor_statefunc boolor_statefunc - 59 16 16 _null_ _null_ )); -DATA(insert ( 2519 booland_statefunc booland_statefunc - 58 16 16 _null_ _null_ )); -#endif -#ifdef PGXC -//DATA(insert ( 2517 booland_statefunc - 58 16 _null_ )); -//DATA(insert ( 2518 boolor_statefunc - 59 16 _null_ )); -//DATA(insert ( 2519 booland_statefunc - 58 16 _null_ )); -#endif +DATA(insert ( 2517 n 0 booland_statefunc booland_statefunc - bool_accum bool_accum_inv bool_alltrue f f 58 16 16 0 2281 16 _null_ __null_ null_ )); +DATA(insert ( 2518 n 0 boolor_statefunc boolor_statefunc - bool_accum bool_accum_inv bool_anytrue f f 59 16 16 0 2281 16 _null_ __null_ null_ )); +DATA(insert ( 2519 n 0 booland_statefunc booland_statefunc - bool_accum bool_accum_inv bool_alltrue f f 58 16 16 0 2281 16 _null_ __null_ null_ )); /* bitwise integer */ -#ifdef PGXC -DATA(insert ( 2236 int2and int2and - 0 21 21 _null_ _null_ )); -DATA(insert ( 2237 int2or int2or - 0 21 21 _null_ _null_ )); -DATA(insert ( 2238 int4and int4and - 0 23 23 _null_ _null_ )); -DATA(insert ( 2239 int4or int4or - 0 23 23 _null_ _null_ )); -DATA(insert ( 2240 int8and int8and - 0 20 20 _null_ _null_ )); -DATA(insert ( 2241 int8or int8or - 0 20 20 _null_ _null_ )); -DATA(insert ( 2242 bitand bitand - 0 1560 1560 _null_ _null_ )); -DATA(insert ( 2243 bitor bitor - 0 1560 1560 _null_ _null_ )); -#endif -#ifdef PGXC -//DATA(insert ( 2236 int2and - 0 21 _null_ )); -//DATA(insert ( 2237 int2or - 0 21 _null_ )); -//DATA(insert ( 2238 int4and - 0 23 _null_ )); -//DATA(insert ( 2239 int4or - 0 23 _null_ )); -//DATA(insert ( 2240 int8and - 0 20 _null_ )); -//DATA(insert ( 2241 int8or - 0 20 _null_ )); -//DATA(insert ( 2242 bitand - 0 1560 _null_ )); -//DATA(insert ( 2243 bitor - 0 1560 _null_ )); -#endif +DATA(insert ( 2236 n 0 int2and int2and - - - - f f 0 21 21 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2237 n 0 int2or int2or - - - - f f 0 21 21 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2238 n 0 int4and int4and - - - - f f 0 23 23 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2239 n 0 int4or int4or - - - - f f 0 23 23 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2240 n 0 int8and int8and - - - - f f 0 20 20 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2241 n 0 int8or int8or - - - - f f 0 20 20 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2242 n 0 bitand bitand - - - - f f 0 1560 1560 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 2243 n 0 bitor bitor - - - - f f 0 1560 1560 0 0 0 _null_ _null_ _null_ )); /* xml */ -#ifdef PGXC -DATA(insert ( 2901 xmlconcat2 - - 0 142 0 _null_ _null_ )); -#endif -#ifdef PGXC -//DATA(insert ( 2901 xmlconcat2 - 0 142 _null_ )); -#endif +DATA(insert ( 2901 n 0 xmlconcat2 - - - - - f f 0 142 0 0 0 0 _null_ _null_ _null_ )); /* array */ -#ifdef PGXC -DATA(insert ( 2335 array_agg_transfn - array_agg_finalfn 0 2281 0 _null_ _null_ )); -#endif -#ifdef PGXC -//DATA(insert ( 2335 array_agg_transfn array_agg_finalfn 0 2281 _null_ )); -#endif +DATA(insert ( 2335 n 0 array_agg_transfn - array_agg_finalfn - - - t f 0 2281 0 0 0 0 _null_ _null_ _null_ )); /* text */ -#ifdef PGXC -DATA(insert (3538 string_agg_transfn - string_agg_finalfn 0 2281 0 _null_ _null_ )); -// XXX function string_agg_delim_transfn is not defined? -//DATA(insert (3538 string_agg_delim_transfn - string_agg_finalfn 0 2281 0 _null_ _null_ )); -#endif -#ifdef PGXC -//DATA(insert (3535 string_agg_transfn string_agg_finalfn 0 2281 _null_ )); -//DATA(insert (3538 string_agg_delim_transfn string_agg_finalfn 0 2281 _null_ )); -#endif +DATA(insert ( 3538 n 0 string_agg_transfn - string_agg_finalfn - - - f f 0 2281 0 0 0 0 _null_ _null_ _null_ )); /* bytea */ -#ifdef PGXC -DATA(insert ( 3545 bytea_string_agg_transfn - bytea_string_agg_finalfn 0 2281 0 _null_ _null_ )); -#endif -#ifdef PGXC -//DATA(insert ( 3545 bytea_string_agg_transfn bytea_string_agg_finalfn 0 2281 _null_ )); -#endif +DATA(insert ( 3545 n 0 bytea_string_agg_transfn - bytea_string_agg_finalfn - - - f f 0 2281 0 0 0 0 _null_ _null_ _null_ )); + +/* json */ +DATA(insert ( 3175 n 0 json_agg_transfn - json_agg_finalfn - - - f f 0 2281 0 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3197 n 0 json_object_agg_transfn - json_object_agg_finalfn - - - f f 0 2281 0 0 0 0 _null_ _null_ _null_ )); + +/* ordered-set and hypothetical-set aggregates */ +DATA(insert ( 3972 o 1 ordered_set_transition - percentile_disc_final - - - t f 0 2281 0 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3974 o 1 ordered_set_transition - percentile_cont_float8_final - - - f f 0 2281 0 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3976 o 1 ordered_set_transition - percentile_cont_interval_final - - - f f 0 2281 0 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3978 o 1 ordered_set_transition - percentile_disc_multi_final - - - t f 0 2281 0 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3980 o 1 ordered_set_transition - percentile_cont_float8_multi_final - - - f f 0 2281 0 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3982 o 1 ordered_set_transition - percentile_cont_interval_multi_final - - - f f 0 2281 0 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3984 o 0 ordered_set_transition - mode_final - - - t f 0 2281 0 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3986 h 1 ordered_set_transition_multi - rank_final - - - t f 0 2281 0 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3988 h 1 ordered_set_transition_multi - percent_rank_final - - - t f 0 2281 0 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3990 h 1 ordered_set_transition_multi - cume_dist_final - - - t f 0 2281 0 0 0 0 _null_ _null_ _null_ )); +DATA(insert ( 3992 h 1 ordered_set_transition_multi - dense_rank_final - - - t f 0 2281 0 0 0 0 _null_ _null_ _null_ )); + /* * prototypes for functions in pg_aggregate.c */ -extern void AggregateCreate(const char *aggName, +extern Oid AggregateCreate(const char *aggName, Oid aggNamespace, - Oid *aggArgTypes, + char aggKind, int numArgs, + int numDirectArgs, + oidvector *parameterTypes, + Datum allParameterTypes, + Datum parameterModes, + Datum parameterNames, + List *parameterDefaults, + Oid variadicArgType, List *aggtransfnName, #ifdef PGXC List *aggcollectfnName, #endif List *aggfinalfnName, + List *aggmtransfnName, + List *aggminvtransfnName, + List *aggmfinalfnName, + bool finalfnExtraArgs, + bool mfinalfnExtraArgs, List *aggsortopName, Oid aggTransType, #ifdef XCP Oid aggCollectType, #endif -#ifdef PGXC + int32 aggTransSpace, + Oid aggmTransType, + int32 aggmTransSpace, const char *agginitval, - const char *agginitcollect); -#else - const char *agginitval); +#ifdef XCP + const char *agginitcollect, #endif + const char *aggminitval); #endif /* PG_AGGREGATE_H */ diff --git a/src/include/catalog/pg_am.h b/src/include/catalog/pg_am.h index 0d7ed6857e..759ea70570 100644 --- a/src/include/catalog/pg_am.h +++ b/src/include/catalog/pg_am.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_am.h @@ -34,11 +34,11 @@ CATALOG(pg_am,2601) { NameData amname; /* access method name */ - int2 amstrategies; /* total number of strategies (operators) by + int16 amstrategies; /* total number of strategies (operators) by * which we can traverse/search this AM. Zero * if AM does not have a fixed set of strategy * assignments. */ - int2 amsupport; /* total number of support functions that this + int16 amsupport; /* total number of support functions that this * AM uses */ bool amcanorder; /* does AM support order by column value? */ bool amcanorderbyop; /* does AM support order by operator result? */ @@ -126,7 +126,7 @@ DESCR("hash index access method"); DATA(insert OID = 783 ( gist 0 8 f t f f t t f t t t f 0 gistinsert gistbeginscan gistgettuple gistgetbitmap gistrescan gistendscan gistmarkpos gistrestrpos gistbuild gistbuildempty gistbulkdelete gistvacuumcleanup - gistcostestimate gistoptions )); DESCR("GiST index access method"); #define GIST_AM_OID 783 -DATA(insert OID = 2742 ( gin 0 5 f f f f t t f f t f f 0 gininsert ginbeginscan - gingetbitmap ginrescan ginendscan ginmarkpos ginrestrpos ginbuild ginbuildempty ginbulkdelete ginvacuumcleanup - gincostestimate ginoptions )); +DATA(insert OID = 2742 ( gin 0 6 f f f f t t f f t f f 0 gininsert ginbeginscan - gingetbitmap ginrescan ginendscan ginmarkpos ginrestrpos ginbuild ginbuildempty ginbulkdelete ginvacuumcleanup - gincostestimate ginoptions )); DESCR("GIN index access method"); #define GIN_AM_OID 2742 DATA(insert OID = 4000 ( spgist 0 5 f f f f f t f t f f f 0 spginsert spgbeginscan spggettuple spggetbitmap spgrescan spgendscan spgmarkpos spgrestrpos spgbuild spgbuildempty spgbulkdelete spgvacuumcleanup spgcanreturn spgcostestimate spgoptions )); diff --git a/src/include/catalog/pg_amop.h b/src/include/catalog/pg_amop.h index 82391b09d8..3ef5a49cc9 100644 --- a/src/include/catalog/pg_amop.h +++ b/src/include/catalog/pg_amop.h @@ -30,7 +30,7 @@ * intentional denormalization of the catalogs to buy lookup speed. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_amop.h @@ -58,7 +58,7 @@ CATALOG(pg_amop,2602) Oid amopfamily; /* the index opfamily this entry is for */ Oid amoplefttype; /* operator's left input data type */ Oid amoprighttype; /* operator's right input data type */ - int2 amopstrategy; /* operator strategy number */ + int16 amopstrategy; /* operator strategy number */ char amoppurpose; /* is operator for 's'earch or 'o'rdering? */ Oid amopopr; /* the operator's pg_operator OID */ Oid amopmethod; /* the index access method this entry is for */ @@ -493,6 +493,16 @@ DATA(insert ( 2994 2249 2249 4 s 2993 403 0 )); DATA(insert ( 2994 2249 2249 5 s 2991 403 0 )); /* + * btree record_image_ops + */ + +DATA(insert ( 3194 2249 2249 1 s 3190 403 0 )); +DATA(insert ( 3194 2249 2249 2 s 3192 403 0 )); +DATA(insert ( 3194 2249 2249 3 s 3188 403 0 )); +DATA(insert ( 3194 2249 2249 4 s 3193 403 0 )); +DATA(insert ( 3194 2249 2249 5 s 3191 403 0 )); + +/* * btree uuid_ops */ @@ -503,6 +513,16 @@ DATA(insert ( 2968 2950 2950 4 s 2977 403 0 )); DATA(insert ( 2968 2950 2950 5 s 2975 403 0 )); /* + * btree pg_lsn_ops + */ + +DATA(insert ( 3253 3220 3220 1 s 3224 403 0 )); +DATA(insert ( 3253 3220 3220 2 s 3226 403 0 )); +DATA(insert ( 3253 3220 3220 3 s 3222 403 0 )); +DATA(insert ( 3253 3220 3220 4 s 3227 403 0 )); +DATA(insert ( 3253 3220 3220 5 s 3225 403 0 )); + +/* * hash index _ops */ @@ -571,6 +591,8 @@ DATA(insert ( 2231 1042 1042 1 s 1054 405 0 )); DATA(insert ( 2235 1033 1033 1 s 974 405 0 )); /* uuid_ops */ DATA(insert ( 2969 2950 2950 1 s 2972 405 0 )); +/* pg_lsn_ops */ +DATA(insert ( 3254 3220 3220 1 s 3222 405 0 )); /* numeric_ops */ DATA(insert ( 1998 1700 1700 1 s 1752 405 0 )); /* array_ops */ @@ -767,4 +789,60 @@ DATA(insert ( 4017 25 25 12 s 665 4000 0 )); DATA(insert ( 4017 25 25 14 s 667 4000 0 )); DATA(insert ( 4017 25 25 15 s 666 4000 0 )); +/* + * btree jsonb_ops + */ +DATA(insert ( 4033 3802 3802 1 s 3242 403 0 )); +DATA(insert ( 4033 3802 3802 2 s 3244 403 0 )); +DATA(insert ( 4033 3802 3802 3 s 3240 403 0 )); +DATA(insert ( 4033 3802 3802 4 s 3245 403 0 )); +DATA(insert ( 4033 3802 3802 5 s 3243 403 0 )); + +/* + * hash jsonb_ops + */ +DATA(insert ( 4034 3802 3802 1 s 3240 405 0 )); + +/* + * GIN jsonb_ops + */ +DATA(insert ( 4036 3802 3802 7 s 3246 2742 0 )); +DATA(insert ( 4036 3802 25 9 s 3247 2742 0 )); +DATA(insert ( 4036 3802 1009 10 s 3248 2742 0 )); +DATA(insert ( 4036 3802 1009 11 s 3249 2742 0 )); + +/* + * GIN jsonb_path_ops + */ +DATA(insert ( 4037 3802 3802 7 s 3246 2742 0 )); + +/* + * SP-GiST range_ops + */ +DATA(insert ( 3474 3831 3831 1 s 3893 4000 0 )); +DATA(insert ( 3474 3831 3831 2 s 3895 4000 0 )); +DATA(insert ( 3474 3831 3831 3 s 3888 4000 0 )); +DATA(insert ( 3474 3831 3831 4 s 3896 4000 0 )); +DATA(insert ( 3474 3831 3831 5 s 3894 4000 0 )); +DATA(insert ( 3474 3831 3831 6 s 3897 4000 0 )); +DATA(insert ( 3474 3831 3831 7 s 3890 4000 0 )); +DATA(insert ( 3474 3831 3831 8 s 3892 4000 0 )); +DATA(insert ( 3474 3831 2283 16 s 3889 4000 0 )); +DATA(insert ( 3474 3831 3831 18 s 3882 4000 0 )); + +/* + * GiST inet_ops + */ +DATA(insert ( 3550 869 869 3 s 3552 783 0 )); +DATA(insert ( 3550 869 869 18 s 1201 783 0 )); +DATA(insert ( 3550 869 869 19 s 1202 783 0 )); +DATA(insert ( 3550 869 869 20 s 1203 783 0 )); +DATA(insert ( 3550 869 869 21 s 1204 783 0 )); +DATA(insert ( 3550 869 869 22 s 1205 783 0 )); +DATA(insert ( 3550 869 869 23 s 1206 783 0 )); +DATA(insert ( 3550 869 869 24 s 931 783 0 )); +DATA(insert ( 3550 869 869 25 s 932 783 0 )); +DATA(insert ( 3550 869 869 26 s 933 783 0 )); +DATA(insert ( 3550 869 869 27 s 934 783 0 )); + #endif /* PG_AMOP_H */ diff --git a/src/include/catalog/pg_amproc.h b/src/include/catalog/pg_amproc.h index 72307dec22..10a47df6be 100644 --- a/src/include/catalog/pg_amproc.h +++ b/src/include/catalog/pg_amproc.h @@ -19,7 +19,7 @@ * some don't pay attention to non-default functions at all. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_amproc.h @@ -47,7 +47,7 @@ CATALOG(pg_amproc,2603) Oid amprocfamily; /* the index opfamily this entry is for */ Oid amproclefttype; /* procedure's left input data type */ Oid amprocrighttype; /* procedure's right input data type */ - int2 amprocnum; /* support procedure index */ + int16 amprocnum; /* support procedure index */ regproc amproc; /* OID of the proc */ } FormData_pg_amproc; @@ -121,7 +121,6 @@ DATA(insert ( 1988 1700 1700 1 1769 )); DATA(insert ( 1989 26 26 1 356 )); DATA(insert ( 1989 26 26 2 3134 )); DATA(insert ( 1991 30 30 1 404 )); -DATA(insert ( 2994 2249 2249 1 2987 )); DATA(insert ( 1994 25 25 1 360 )); DATA(insert ( 1996 1083 1083 1 1107 )); DATA(insert ( 2000 1266 1266 1 1358 )); @@ -133,7 +132,14 @@ DATA(insert ( 2233 703 703 1 380 )); DATA(insert ( 2234 704 704 1 381 )); DATA(insert ( 2789 27 27 1 2794 )); DATA(insert ( 2968 2950 2950 1 2960 )); +DATA(insert ( 2994 2249 2249 1 2987 )); +DATA(insert ( 3194 2249 2249 1 3187 )); +DATA(insert ( 3253 3220 3220 1 3251 )); DATA(insert ( 3522 3500 3500 1 3514 )); +DATA(insert ( 3626 3614 3614 1 3622 )); +DATA(insert ( 3683 3615 3615 1 3668 )); +DATA(insert ( 3901 3831 3831 1 3870 )); +DATA(insert ( 4033 3802 3802 1 4044 )); /* hash */ @@ -169,10 +175,21 @@ DATA(insert ( 2229 25 25 1 400 )); DATA(insert ( 2231 1042 1042 1 1080 )); DATA(insert ( 2235 1033 1033 1 329 )); DATA(insert ( 2969 2950 2950 1 2963 )); +DATA(insert ( 3254 3220 3220 1 3252 )); DATA(insert ( 3523 3500 3500 1 3515 )); +DATA(insert ( 3903 3831 3831 1 3902 )); +DATA(insert ( 4034 3802 3802 1 4045 )); /* gist */ +DATA(insert ( 1029 600 600 1 2179 )); +DATA(insert ( 1029 600 600 2 2583 )); +DATA(insert ( 1029 600 600 3 1030 )); +DATA(insert ( 1029 600 600 4 2580 )); +DATA(insert ( 1029 600 600 5 2581 )); +DATA(insert ( 1029 600 600 6 2582 )); +DATA(insert ( 1029 600 600 7 2584 )); +DATA(insert ( 1029 600 600 8 3064 )); DATA(insert ( 2593 603 603 1 2578 )); DATA(insert ( 2593 603 603 2 2583 )); DATA(insert ( 2593 603 603 3 2579 )); @@ -208,14 +225,13 @@ DATA(insert ( 3702 3615 3615 4 3696 )); DATA(insert ( 3702 3615 3615 5 3700 )); DATA(insert ( 3702 3615 3615 6 3697 )); DATA(insert ( 3702 3615 3615 7 3699 )); -DATA(insert ( 1029 600 600 1 2179 )); -DATA(insert ( 1029 600 600 2 2583 )); -DATA(insert ( 1029 600 600 3 1030 )); -DATA(insert ( 1029 600 600 4 2580 )); -DATA(insert ( 1029 600 600 5 2581 )); -DATA(insert ( 1029 600 600 6 2582 )); -DATA(insert ( 1029 600 600 7 2584 )); -DATA(insert ( 1029 600 600 8 3064 )); +DATA(insert ( 3919 3831 3831 1 3875 )); +DATA(insert ( 3919 3831 3831 2 3876 )); +DATA(insert ( 3919 3831 3831 3 3877 )); +DATA(insert ( 3919 3831 3831 4 3878 )); +DATA(insert ( 3919 3831 3831 5 3879 )); +DATA(insert ( 3919 3831 3831 6 3880 )); +DATA(insert ( 3919 3831 3831 7 3881 )); /* gin */ @@ -223,141 +239,182 @@ DATA(insert ( 2745 1007 1007 1 351 )); DATA(insert ( 2745 1007 1007 2 2743 )); DATA(insert ( 2745 1007 1007 3 2774 )); DATA(insert ( 2745 1007 1007 4 2744 )); +DATA(insert ( 2745 1007 1007 6 3920 )); DATA(insert ( 2745 1009 1009 1 360 )); DATA(insert ( 2745 1009 1009 2 2743 )); DATA(insert ( 2745 1009 1009 3 2774 )); DATA(insert ( 2745 1009 1009 4 2744 )); +DATA(insert ( 2745 1009 1009 6 3920 )); DATA(insert ( 2745 1015 1015 1 360 )); DATA(insert ( 2745 1015 1015 2 2743 )); DATA(insert ( 2745 1015 1015 3 2774 )); DATA(insert ( 2745 1015 1015 4 2744 )); +DATA(insert ( 2745 1015 1015 6 3920 )); DATA(insert ( 2745 1023 1023 1 357 )); DATA(insert ( 2745 1023 1023 2 2743 )); DATA(insert ( 2745 1023 1023 3 2774 )); DATA(insert ( 2745 1023 1023 4 2744 )); +DATA(insert ( 2745 1023 1023 6 3920 )); DATA(insert ( 2745 1561 1561 1 1596 )); DATA(insert ( 2745 1561 1561 2 2743 )); DATA(insert ( 2745 1561 1561 3 2774 )); DATA(insert ( 2745 1561 1561 4 2744 )); +DATA(insert ( 2745 1561 1561 6 3920 )); DATA(insert ( 2745 1000 1000 1 1693 )); DATA(insert ( 2745 1000 1000 2 2743 )); DATA(insert ( 2745 1000 1000 3 2774 )); DATA(insert ( 2745 1000 1000 4 2744 )); +DATA(insert ( 2745 1000 1000 6 3920 )); DATA(insert ( 2745 1014 1014 1 1078 )); DATA(insert ( 2745 1014 1014 2 2743 )); DATA(insert ( 2745 1014 1014 3 2774 )); DATA(insert ( 2745 1014 1014 4 2744 )); +DATA(insert ( 2745 1014 1014 6 3920 )); DATA(insert ( 2745 1001 1001 1 1954 )); DATA(insert ( 2745 1001 1001 2 2743 )); DATA(insert ( 2745 1001 1001 3 2774 )); DATA(insert ( 2745 1001 1001 4 2744 )); +DATA(insert ( 2745 1001 1001 6 3920 )); DATA(insert ( 2745 1002 1002 1 358 )); DATA(insert ( 2745 1002 1002 2 2743 )); DATA(insert ( 2745 1002 1002 3 2774 )); DATA(insert ( 2745 1002 1002 4 2744 )); +DATA(insert ( 2745 1002 1002 6 3920 )); DATA(insert ( 2745 1182 1182 1 1092 )); DATA(insert ( 2745 1182 1182 2 2743 )); DATA(insert ( 2745 1182 1182 3 2774 )); DATA(insert ( 2745 1182 1182 4 2744 )); +DATA(insert ( 2745 1182 1182 6 3920 )); DATA(insert ( 2745 1021 1021 1 354 )); DATA(insert ( 2745 1021 1021 2 2743 )); DATA(insert ( 2745 1021 1021 3 2774 )); DATA(insert ( 2745 1021 1021 4 2744 )); +DATA(insert ( 2745 1021 1021 6 3920 )); DATA(insert ( 2745 1022 1022 1 355 )); DATA(insert ( 2745 1022 1022 2 2743 )); DATA(insert ( 2745 1022 1022 3 2774 )); DATA(insert ( 2745 1022 1022 4 2744 )); +DATA(insert ( 2745 1022 1022 6 3920 )); DATA(insert ( 2745 1041 1041 1 926 )); DATA(insert ( 2745 1041 1041 2 2743 )); DATA(insert ( 2745 1041 1041 3 2774 )); DATA(insert ( 2745 1041 1041 4 2744 )); +DATA(insert ( 2745 1041 1041 6 3920 )); DATA(insert ( 2745 651 651 1 926 )); DATA(insert ( 2745 651 651 2 2743 )); DATA(insert ( 2745 651 651 3 2774 )); DATA(insert ( 2745 651 651 4 2744 )); +DATA(insert ( 2745 651 651 6 3920 )); DATA(insert ( 2745 1005 1005 1 350 )); DATA(insert ( 2745 1005 1005 2 2743 )); DATA(insert ( 2745 1005 1005 3 2774 )); DATA(insert ( 2745 1005 1005 4 2744 )); +DATA(insert ( 2745 1005 1005 6 3920 )); DATA(insert ( 2745 1016 1016 1 842 )); DATA(insert ( 2745 1016 1016 2 2743 )); DATA(insert ( 2745 1016 1016 3 2774 )); DATA(insert ( 2745 1016 1016 4 2744 )); +DATA(insert ( 2745 1016 1016 6 3920 )); DATA(insert ( 2745 1187 1187 1 1315 )); DATA(insert ( 2745 1187 1187 2 2743 )); DATA(insert ( 2745 1187 1187 3 2774 )); DATA(insert ( 2745 1187 1187 4 2744 )); +DATA(insert ( 2745 1187 1187 6 3920 )); DATA(insert ( 2745 1040 1040 1 836 )); DATA(insert ( 2745 1040 1040 2 2743 )); DATA(insert ( 2745 1040 1040 3 2774 )); DATA(insert ( 2745 1040 1040 4 2744 )); +DATA(insert ( 2745 1040 1040 6 3920 )); DATA(insert ( 2745 1003 1003 1 359 )); DATA(insert ( 2745 1003 1003 2 2743 )); DATA(insert ( 2745 1003 1003 3 2774 )); DATA(insert ( 2745 1003 1003 4 2744 )); +DATA(insert ( 2745 1003 1003 6 3920 )); DATA(insert ( 2745 1231 1231 1 1769 )); DATA(insert ( 2745 1231 1231 2 2743 )); DATA(insert ( 2745 1231 1231 3 2774 )); DATA(insert ( 2745 1231 1231 4 2744 )); +DATA(insert ( 2745 1231 1231 6 3920 )); DATA(insert ( 2745 1028 1028 1 356 )); DATA(insert ( 2745 1028 1028 2 2743 )); DATA(insert ( 2745 1028 1028 3 2774 )); DATA(insert ( 2745 1028 1028 4 2744 )); +DATA(insert ( 2745 1028 1028 6 3920 )); DATA(insert ( 2745 1013 1013 1 404 )); DATA(insert ( 2745 1013 1013 2 2743 )); DATA(insert ( 2745 1013 1013 3 2774 )); DATA(insert ( 2745 1013 1013 4 2744 )); +DATA(insert ( 2745 1013 1013 6 3920 )); DATA(insert ( 2745 1183 1183 1 1107 )); DATA(insert ( 2745 1183 1183 2 2743 )); DATA(insert ( 2745 1183 1183 3 2774 )); DATA(insert ( 2745 1183 1183 4 2744 )); +DATA(insert ( 2745 1183 1183 6 3920 )); DATA(insert ( 2745 1185 1185 1 1314 )); DATA(insert ( 2745 1185 1185 2 2743 )); DATA(insert ( 2745 1185 1185 3 2774 )); DATA(insert ( 2745 1185 1185 4 2744 )); +DATA(insert ( 2745 1185 1185 6 3920 )); DATA(insert ( 2745 1270 1270 1 1358 )); DATA(insert ( 2745 1270 1270 2 2743 )); DATA(insert ( 2745 1270 1270 3 2774 )); DATA(insert ( 2745 1270 1270 4 2744 )); +DATA(insert ( 2745 1270 1270 6 3920 )); DATA(insert ( 2745 1563 1563 1 1672 )); DATA(insert ( 2745 1563 1563 2 2743 )); DATA(insert ( 2745 1563 1563 3 2774 )); DATA(insert ( 2745 1563 1563 4 2744 )); +DATA(insert ( 2745 1563 1563 6 3920 )); DATA(insert ( 2745 1115 1115 1 2045 )); DATA(insert ( 2745 1115 1115 2 2743 )); DATA(insert ( 2745 1115 1115 3 2774 )); DATA(insert ( 2745 1115 1115 4 2744 )); +DATA(insert ( 2745 1115 1115 6 3920 )); DATA(insert ( 2745 791 791 1 377 )); DATA(insert ( 2745 791 791 2 2743 )); DATA(insert ( 2745 791 791 3 2774 )); DATA(insert ( 2745 791 791 4 2744 )); +DATA(insert ( 2745 791 791 6 3920 )); DATA(insert ( 2745 1024 1024 1 380 )); DATA(insert ( 2745 1024 1024 2 2743 )); DATA(insert ( 2745 1024 1024 3 2774 )); DATA(insert ( 2745 1024 1024 4 2744 )); +DATA(insert ( 2745 1024 1024 6 3920 )); DATA(insert ( 2745 1025 1025 1 381 )); DATA(insert ( 2745 1025 1025 2 2743 )); DATA(insert ( 2745 1025 1025 3 2774 )); DATA(insert ( 2745 1025 1025 4 2744 )); +DATA(insert ( 2745 1025 1025 6 3920 )); DATA(insert ( 3659 3614 3614 1 3724 )); DATA(insert ( 3659 3614 3614 2 3656 )); DATA(insert ( 3659 3614 3614 3 3657 )); DATA(insert ( 3659 3614 3614 4 3658 )); DATA(insert ( 3659 3614 3614 5 2700 )); -DATA(insert ( 3626 3614 3614 1 3622 )); -DATA(insert ( 3683 3615 3615 1 3668 )); -DATA(insert ( 3901 3831 3831 1 3870 )); -DATA(insert ( 3903 3831 3831 1 3902 )); -DATA(insert ( 3919 3831 3831 1 3875 )); -DATA(insert ( 3919 3831 3831 2 3876 )); -DATA(insert ( 3919 3831 3831 3 3877 )); -DATA(insert ( 3919 3831 3831 4 3878 )); -DATA(insert ( 3919 3831 3831 5 3879 )); -DATA(insert ( 3919 3831 3831 6 3880 )); -DATA(insert ( 3919 3831 3831 7 3881 )); - +DATA(insert ( 3659 3614 3614 6 3921 )); +DATA(insert ( 4036 3802 3802 1 3480 )); +DATA(insert ( 4036 3802 3802 2 3482 )); +DATA(insert ( 4036 3802 3802 3 3483 )); +DATA(insert ( 4036 3802 3802 4 3484 )); +DATA(insert ( 4036 3802 3802 6 3488 )); +DATA(insert ( 4037 3802 3802 1 351 )); +DATA(insert ( 4037 3802 3802 2 3485 )); +DATA(insert ( 4037 3802 3802 3 3486 )); +DATA(insert ( 4037 3802 3802 4 3487 )); +DATA(insert ( 4037 3802 3802 6 3489 )); +DATA(insert ( 3550 869 869 1 3553 )); +DATA(insert ( 3550 869 869 2 3554 )); +DATA(insert ( 3550 869 869 3 3555 )); +DATA(insert ( 3550 869 869 4 3556 )); +DATA(insert ( 3550 869 869 5 3557 )); +DATA(insert ( 3550 869 869 6 3558 )); +DATA(insert ( 3550 869 869 7 3559 )); /* sp-gist */ +DATA(insert ( 3474 3831 3831 1 3469 )); +DATA(insert ( 3474 3831 3831 2 3470 )); +DATA(insert ( 3474 3831 3831 3 3471 )); +DATA(insert ( 3474 3831 3831 4 3472 )); +DATA(insert ( 3474 3831 3831 5 3473 )); DATA(insert ( 4015 600 600 1 4018 )); DATA(insert ( 4015 600 600 2 4019 )); DATA(insert ( 4015 600 600 3 4020 )); diff --git a/src/include/catalog/pg_attrdef.h b/src/include/catalog/pg_attrdef.h index b92fd1593f..b8ceefd7cd 100644 --- a/src/include/catalog/pg_attrdef.h +++ b/src/include/catalog/pg_attrdef.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_attrdef.h @@ -22,7 +22,7 @@ #include "catalog/genbki.h" /* ---------------- - * pg_attrdef definition. cpp turns this into + * pg_attrdef definition. cpp turns this into * typedef struct FormData_pg_attrdef * ---------------- */ @@ -31,7 +31,7 @@ CATALOG(pg_attrdef,2604) { Oid adrelid; /* OID of table containing attribute */ - int2 adnum; /* attnum of attribute */ + int16 adnum; /* attnum of attribute */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ pg_node_tree adbin; /* nodeToString representation of default */ diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index 4ee1d90ce3..cdde814307 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_attribute.h @@ -54,13 +54,13 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK * that no value has been explicitly set for this column, so ANALYZE * should use the default setting. */ - int4 attstattarget; + int32 attstattarget; /* * attlen is a copy of the typlen field from pg_type for this attribute. * See atttypid comments above. */ - int2 attlen; + int16 attlen; /* * attnum is the "attribute number" for the attribute: A value that @@ -75,13 +75,13 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK * * Note that (attnum - 1) is often used as the index to an array. */ - int2 attnum; + int16 attnum; /* * attndims is the declared number of dimensions, if an array type, * otherwise zero. */ - int4 attndims; + int32 attndims; /* * fastgetattr() uses attcacheoff to cache byte offsets of attributes in @@ -90,7 +90,7 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK * descriptor, we may then update attcacheoff in the copies. This speeds * up the attribute walking process. */ - int4 attcacheoff; + int32 attcacheoff; /* * atttypmod records type-specific data supplied at table creation time @@ -98,7 +98,7 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK * type-specific input and output functions as the third argument. The * value will generally be -1 for types that do not need typmod. */ - int4 atttypmod; + int32 atttypmod; /* * attbyval is a copy of the typbyval field from pg_type for this @@ -140,7 +140,7 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK bool attislocal; /* Number of times inherited from direct parent relation(s) */ - int4 attinhcount; + int32 attinhcount; /* attribute's collation */ Oid attcollation; @@ -161,7 +161,7 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK /* * ATTRIBUTE_FIXED_PART_SIZE is the size of the fixed-layout, - * guaranteed-not-null part of a pg_attribute row. This is in fact as much + * guaranteed-not-null part of a pg_attribute row. This is in fact as much * of the row as gets copied into tuple descriptors, so don't expect you * can access fields beyond attcollation except in a real tuple! */ diff --git a/src/include/catalog/pg_auth_members.h b/src/include/catalog/pg_auth_members.h index ea2deb7c91..ac14457c44 100644 --- a/src/include/catalog/pg_auth_members.h +++ b/src/include/catalog/pg_auth_members.h @@ -5,7 +5,7 @@ * (pg_auth_members) along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_auth_members.h diff --git a/src/include/catalog/pg_authid.h b/src/include/catalog/pg_authid.h index e96c875f58..e7c32c9fa6 100644 --- a/src/include/catalog/pg_authid.h +++ b/src/include/catalog/pg_authid.h @@ -7,7 +7,7 @@ * pg_shadow and pg_group are now publicly accessible views on pg_authid. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_authid.h @@ -26,7 +26,7 @@ /* * The CATALOG definition has to refer to the type of rolvaliduntil as * "timestamptz" (lower case) so that bootstrap mode recognizes it. But - * the C header files define this type as TimestampTz. Since the field is + * the C header files define this type as TimestampTz. Since the field is * potentially-null and therefore can't be accessed directly from C code, * there is no particular need for the C struct definition to show the * field type as TimestampTz --- instead we just make it int. @@ -52,7 +52,7 @@ CATALOG(pg_authid,1260) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842) BKI_SCHEMA_MAC bool rolcatupdate; /* allowed to alter catalogs manually? */ bool rolcanlogin; /* allowed to log in as session user? */ bool rolreplication; /* role used for streaming replication */ - int4 rolconnlimit; /* max connections allowed (-1=no limit) */ + int32 rolconnlimit; /* max connections allowed (-1=no limit) */ /* remaining fields may be null; use heap_getattr to read them! */ text rolpassword; /* password, if any */ diff --git a/src/include/catalog/pg_cast.h b/src/include/catalog/pg_cast.h index ac2b2968eb..e037957472 100644 --- a/src/include/catalog/pg_cast.h +++ b/src/include/catalog/pg_cast.h @@ -8,7 +8,7 @@ * but also length coercion functions. * * - * Copyright (c) 2002-2012, PostgreSQL Global Development Group + * Copyright (c) 2002-2014, PostgreSQL Global Development Group * * src/include/catalog/pg_cast.h * @@ -359,4 +359,8 @@ DATA(insert ( 1560 1560 1685 i f )); DATA(insert ( 1562 1562 1687 i f )); DATA(insert ( 1700 1700 1703 i f )); +/* json to/from jsonb */ +DATA(insert ( 114 3802 0 e i )); +DATA(insert ( 3802 114 0 e i )); + #endif /* PG_CAST_H */ diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index 1567206a7e..f2fb317e5f 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_class.h @@ -43,30 +43,33 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO /* relfilenode == 0 means it is a "mapped" relation, see relmapper.c */ Oid reltablespace; /* identifier of table space for relation */ - int4 relpages; /* # of blocks (not always up-to-date) */ + int32 relpages; /* # of blocks (not always up-to-date) */ float4 reltuples; /* # of tuples (not always up-to-date) */ - int4 relallvisible; /* # of all-visible blocks (not always + int32 relallvisible; /* # of all-visible blocks (not always * up-to-date) */ Oid reltoastrelid; /* OID of toast table; 0 if none */ - Oid reltoastidxid; /* if toast table, OID of chunk_id index */ bool relhasindex; /* T if has (or has had) any indexes */ bool relisshared; /* T if shared across databases */ char relpersistence; /* see RELPERSISTENCE_xxx constants below */ char relkind; /* see RELKIND_xxx constants below */ - int2 relnatts; /* number of user attributes */ + int16 relnatts; /* number of user attributes */ /* * Class pg_attribute must contain exactly "relnatts" user attributes * (with attnums ranging from 1 to relnatts) for this class. It may also * contain entries with negative attnums for system attributes. */ - int2 relchecks; /* # of CHECK constraints for class */ + int16 relchecks; /* # of CHECK constraints for class */ bool relhasoids; /* T if we generate OIDs for rows of rel */ bool relhaspkey; /* has (or has had) PRIMARY KEY index */ bool relhasrules; /* has (or has had) any rules */ bool relhastriggers; /* has (or has had) any TRIGGERs */ bool relhassubclass; /* has (or has had) derived classes */ + bool relispopulated; /* matview currently holds query results */ + char relreplident; /* see REPLICA_IDENTITY_xxx constants */ TransactionId relfrozenxid; /* all Xids < this are frozen in this rel */ + TransactionId relminmxid; /* all multixacts in this rel are >= this. + * this is really a MultiXactId */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ /* NOTE: These fields are not present in a relcache entry's rd_rel field. */ @@ -77,7 +80,7 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO /* Size of fixed part of pg_class tuples, not counting var-length fields */ #define CLASS_TUPLE_SIZE \ - (offsetof(FormData_pg_class,relfrozenxid) + sizeof(TransactionId)) + (offsetof(FormData_pg_class,relminmxid) + sizeof(TransactionId)) /* ---------------- * Form_pg_class corresponds to a pointer to a tuple with @@ -91,7 +94,7 @@ typedef FormData_pg_class *Form_pg_class; * ---------------- */ -#define Natts_pg_class 27 +#define Natts_pg_class 29 #define Anum_pg_class_relname 1 #define Anum_pg_class_relnamespace 2 #define Anum_pg_class_reltype 3 @@ -104,21 +107,23 @@ typedef FormData_pg_class *Form_pg_class; #define Anum_pg_class_reltuples 10 #define Anum_pg_class_relallvisible 11 #define Anum_pg_class_reltoastrelid 12 -#define Anum_pg_class_reltoastidxid 13 -#define Anum_pg_class_relhasindex 14 -#define Anum_pg_class_relisshared 15 -#define Anum_pg_class_relpersistence 16 -#define Anum_pg_class_relkind 17 -#define Anum_pg_class_relnatts 18 -#define Anum_pg_class_relchecks 19 -#define Anum_pg_class_relhasoids 20 -#define Anum_pg_class_relhaspkey 21 -#define Anum_pg_class_relhasrules 22 -#define Anum_pg_class_relhastriggers 23 -#define Anum_pg_class_relhassubclass 24 -#define Anum_pg_class_relfrozenxid 25 -#define Anum_pg_class_relacl 26 -#define Anum_pg_class_reloptions 27 +#define Anum_pg_class_relhasindex 13 +#define Anum_pg_class_relisshared 14 +#define Anum_pg_class_relpersistence 15 +#define Anum_pg_class_relkind 16 +#define Anum_pg_class_relnatts 17 +#define Anum_pg_class_relchecks 18 +#define Anum_pg_class_relhasoids 19 +#define Anum_pg_class_relhaspkey 20 +#define Anum_pg_class_relhasrules 21 +#define Anum_pg_class_relhastriggers 22 +#define Anum_pg_class_relhassubclass 23 +#define Anum_pg_class_relispopulated 24 +#define Anum_pg_class_relreplident 25 +#define Anum_pg_class_relfrozenxid 26 +#define Anum_pg_class_relminmxid 27 +#define Anum_pg_class_relacl 28 +#define Anum_pg_class_reloptions 29 /* ---------------- * initial contents of pg_class @@ -129,14 +134,17 @@ typedef FormData_pg_class *Form_pg_class; * ---------------- */ -/* Note: "3" in the relfrozenxid column stands for FirstNormalTransactionId */ -DATA(insert OID = 1247 ( pg_type PGNSP 71 0 PGUID 0 0 0 0 0 0 0 0 f f p r 30 0 t f f f f 3 _null_ _null_ )); +/* + * Note: "3" in the relfrozenxid column stands for FirstNormalTransactionId; + * similarly, "1" in relminmxid stands for FirstMultiXactId + */ +DATA(insert OID = 1247 ( pg_type PGNSP 71 0 PGUID 0 0 0 0 0 0 0 f f p r 30 0 t f f f f t n 3 1 _null_ _null_ )); DESCR(""); -DATA(insert OID = 1249 ( pg_attribute PGNSP 75 0 PGUID 0 0 0 0 0 0 0 0 f f p r 21 0 f f f f f 3 _null_ _null_ )); +DATA(insert OID = 1249 ( pg_attribute PGNSP 75 0 PGUID 0 0 0 0 0 0 0 f f p r 21 0 f f f f f t n 3 1 _null_ _null_ )); DESCR(""); -DATA(insert OID = 1255 ( pg_proc PGNSP 81 0 PGUID 0 0 0 0 0 0 0 0 f f p r 27 0 t f f f f 3 _null_ _null_ )); +DATA(insert OID = 1255 ( pg_proc PGNSP 81 0 PGUID 0 0 0 0 0 0 0 f f p r 27 0 t f f f f t n 3 1 _null_ _null_ )); DESCR(""); -DATA(insert OID = 1259 ( pg_class PGNSP 83 0 PGUID 0 0 0 0 0 0 0 0 f f p r 27 0 t f f f f 3 _null_ _null_ )); +DATA(insert OID = 1259 ( pg_class PGNSP 83 0 PGUID 0 0 0 0 0 0 0 f f p r 29 0 t f f f f t n 3 1 _null_ _null_ )); DESCR(""); @@ -147,10 +155,22 @@ DESCR(""); #define RELKIND_VIEW 'v' /* view */ #define RELKIND_COMPOSITE_TYPE 'c' /* composite type */ #define RELKIND_FOREIGN_TABLE 'f' /* foreign table */ -#define RELKIND_UNCATALOGED 'u' /* not yet cataloged */ +#define RELKIND_MATVIEW 'm' /* materialized view */ #define RELPERSISTENCE_PERMANENT 'p' /* regular table */ #define RELPERSISTENCE_UNLOGGED 'u' /* unlogged permanent table */ #define RELPERSISTENCE_TEMP 't' /* temporary table */ +/* default selection for replica identity (primary key or nothing) */ +#define REPLICA_IDENTITY_DEFAULT 'd' +/* no replica identity is logged for this relation */ +#define REPLICA_IDENTITY_NOTHING 'n' +/* all columns are loged as replica identity */ +#define REPLICA_IDENTITY_FULL 'f' +/* + * an explicitly chosen candidate key's columns are used as identity; + * will still be set if the index has been dropped, in that case it + * has the same meaning as 'd' + */ +#define REPLICA_IDENTITY_INDEX 'i' #endif /* PG_CLASS_H */ diff --git a/src/include/catalog/pg_collation.h b/src/include/catalog/pg_collation.h index 8a1917e4f2..6d0b68012c 100644 --- a/src/include/catalog/pg_collation.h +++ b/src/include/catalog/pg_collation.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION @@ -34,7 +34,7 @@ CATALOG(pg_collation,3456) NameData collname; /* collation name */ Oid collnamespace; /* OID of namespace containing collation */ Oid collowner; /* owner of collation */ - int4 collencoding; /* encoding for this collation; -1 = "all" */ + int32 collencoding; /* encoding for this collation; -1 = "all" */ NameData collcollate; /* LC_COLLATE setting */ NameData collctype; /* LC_CTYPE setting */ } FormData_pg_collation; diff --git a/src/include/catalog/pg_collation_fn.h b/src/include/catalog/pg_collation_fn.h index 62f158256d..62841155ad 100644 --- a/src/include/catalog/pg_collation_fn.h +++ b/src/include/catalog/pg_collation_fn.h @@ -4,7 +4,7 @@ * prototypes for functions in catalog/pg_collation.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_collation_fn.h diff --git a/src/include/catalog/pg_constraint.h b/src/include/catalog/pg_constraint.h index b9e4bf41f9..014b85bd20 100644 --- a/src/include/catalog/pg_constraint.h +++ b/src/include/catalog/pg_constraint.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_constraint.h @@ -20,6 +20,7 @@ #define PG_CONSTRAINT_H #include "catalog/genbki.h" +#include "catalog/dependency.h" #include "nodes/pg_list.h" /* ---------------- @@ -37,7 +38,7 @@ CATALOG(pg_constraint,2606) * relations. This is partly for backwards compatibility with past * Postgres practice, and partly because we don't want to have to obtain a * global lock to generate a globally unique name for a nameless - * constraint. We associate a namespace with constraint names only for + * constraint. We associate a namespace with constraint names only for * SQL-spec compatibility. */ NameData conname; /* name of this constraint */ @@ -56,7 +57,7 @@ CATALOG(pg_constraint,2606) /* * contypid links to the pg_type row for a domain if this is a domain - * constraint. Otherwise it's 0. + * constraint. Otherwise it's 0. * * For SQL-style global ASSERTIONs, both conrelid and contypid would be * zero. This is not presently supported, however. @@ -75,7 +76,7 @@ CATALOG(pg_constraint,2606) /* * These fields, plus confkey, are only meaningful for a foreign-key - * constraint. Otherwise confrelid is 0 and the char fields are spaces. + * constraint. Otherwise confrelid is 0 and the char fields are spaces. */ Oid confrelid; /* relation referenced by foreign key */ char confupdtype; /* foreign key's ON UPDATE action */ @@ -86,7 +87,7 @@ CATALOG(pg_constraint,2606) bool conislocal; /* Number of times inherited from direct parent relation(s) */ - int4 coninhcount; + int32 coninhcount; /* Has a local definition and cannot be inherited */ bool connoinherit; @@ -97,12 +98,12 @@ CATALOG(pg_constraint,2606) * Columns of conrelid that the constraint applies to, if known (this is * NULL for trigger constraints) */ - int2 conkey[1]; + int16 conkey[1]; /* * If a foreign key, the referenced columns of confrelid */ - int2 confkey[1]; + int16 confkey[1]; /* * If a foreign key, the OIDs of the PK = FK equality operators for each @@ -231,7 +232,8 @@ extern Oid CreateConstraintEntry(const char *constraintName, const char *conSrc, bool conIsLocal, int conInhCount, - bool conIsOnly); + bool conNoInherit, + bool is_internal); extern void RemoveConstraintById(Oid conId); extern void RenameConstraintById(Oid conId, const char *newname); @@ -244,7 +246,8 @@ extern char *ChooseConstraintName(const char *name1, const char *name2, List *others); extern void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId, - Oid newNspId, bool isType); + Oid newNspId, bool isType, ObjectAddresses *objsMoved); +extern void get_constraint_relation_oids(Oid constraint_oid, Oid *conrelid, Oid *confrelid); extern Oid get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok); extern Oid get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok); diff --git a/src/include/catalog/pg_control.h b/src/include/catalog/pg_control.h index 5cff39608b..ba79d253ae 100644 --- a/src/include/catalog/pg_control.h +++ b/src/include/catalog/pg_control.h @@ -5,7 +5,7 @@ * However, we define it here so that the format is documented. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_control.h @@ -21,7 +21,7 @@ /* Version identifier for this pg_control format */ -#define PG_CONTROL_VERSION 922 +#define PG_CONTROL_VERSION 942 /* * Body of CheckPoint XLOG records. This is declared here because we keep @@ -33,6 +33,8 @@ typedef struct CheckPoint XLogRecPtr redo; /* next RecPtr available when we began to * create CheckPoint (i.e. REDO start point) */ TimeLineID ThisTimeLineID; /* current TLI */ + TimeLineID PrevTimeLineID; /* previous TLI, if this record begins a new + * timeline (equals ThisTimeLineID otherwise) */ bool fullPageWrites; /* current full_page_writes */ uint32 nextXidEpoch; /* higher-order bits of nextXid */ TransactionId nextXid; /* next free XID */ @@ -41,6 +43,8 @@ typedef struct CheckPoint MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ Oid oldestXidDB; /* database with minimum datfrozenxid */ + MultiXactId oldestMulti; /* cluster-wide minimum datminmxid */ + Oid oldestMultiDB; /* database with minimum datminmxid */ pg_time_t time; /* time stamp of checkpoint */ /* @@ -61,7 +65,9 @@ typedef struct CheckPoint #define XLOG_BACKUP_END 0x50 #define XLOG_PARAMETER_CHANGE 0x60 #define XLOG_RESTORE_POINT 0x70 -#define XLOG_FPW_CHANGE 0x80 +#define XLOG_FPW_CHANGE 0x80 +#define XLOG_END_OF_RECOVERY 0x90 +#define XLOG_FPI 0xA0 /* @@ -96,9 +102,9 @@ typedef struct ControlFileData uint64 system_identifier; /* - * Version identifier information. Keep these fields at the same offset, + * Version identifier information. Keep these fields at the same offset, * especially pg_control_version; they won't be real useful if they move - * around. (For historical reasons they must be 8 bytes into the file + * around. (For historical reasons they must be 8 bytes into the file * rather than immediately at the front.) * * pg_control_version identifies the format of pg_control itself. @@ -121,6 +127,8 @@ typedef struct ControlFileData CheckPoint checkPointCopy; /* copy of last check point record */ + XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */ + /* * These two values determine the minimum point we must recover up to * before starting up: @@ -153,6 +161,7 @@ typedef struct ControlFileData * pg_start_backup() call, not accompanied by pg_stop_backup(). */ XLogRecPtr minRecoveryPoint; + TimeLineID minRecoveryPointTLI; XLogRecPtr backupStartPoint; XLogRecPtr backupEndPoint; bool backupEndRequired; @@ -162,7 +171,9 @@ typedef struct ControlFileData * or hot standby. */ int wal_level; + bool wal_log_hints; int MaxConnections; + int max_worker_processes; int max_prepared_xacts; int max_locks_per_xact; @@ -196,6 +207,7 @@ typedef struct ControlFileData uint32 indexMaxKeys; /* max number of columns in an index */ uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + uint32 loblksize; /* chunk size in pg_largeobject */ /* flag indicating internal format of timestamp, interval, time */ bool enableIntTimes; /* int64 storage enabled? */ @@ -204,6 +216,9 @@ typedef struct ControlFileData bool float4ByVal; /* float4 pass-by-value? */ bool float8ByVal; /* float8, int8, etc pass-by-value? */ + /* Are data pages protected by checksums? Zero if no checksum version */ + uint32 data_checksum_version; + /* CRC of all above ... MUST BE LAST! */ pg_crc32 crc; } ControlFileData; diff --git a/src/include/catalog/pg_conversion.h b/src/include/catalog/pg_conversion.h index 04fe3e8706..db5e28be17 100644 --- a/src/include/catalog/pg_conversion.h +++ b/src/include/catalog/pg_conversion.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_conversion.h @@ -42,8 +42,8 @@ CATALOG(pg_conversion,2607) NameData conname; Oid connamespace; Oid conowner; - int4 conforencoding; - int4 contoencoding; + int32 conforencoding; + int32 contoencoding; regproc conproc; bool condefault; } FormData_pg_conversion; diff --git a/src/include/catalog/pg_conversion_fn.h b/src/include/catalog/pg_conversion_fn.h index f860522278..d49d2f910b 100644 --- a/src/include/catalog/pg_conversion_fn.h +++ b/src/include/catalog/pg_conversion_fn.h @@ -4,7 +4,7 @@ * prototypes for functions in catalog/pg_conversion.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_conversion_fn.h diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h index af803bba89..4e8db873e7 100644 --- a/src/include/catalog/pg_database.h +++ b/src/include/catalog/pg_database.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_database.h @@ -33,14 +33,15 @@ CATALOG(pg_database,1262) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248) BKI_SCHEMA_M { NameData datname; /* database name */ Oid datdba; /* owner of database */ - int4 encoding; /* character encoding */ + int32 encoding; /* character encoding */ NameData datcollate; /* LC_COLLATE setting */ NameData datctype; /* LC_CTYPE setting */ bool datistemplate; /* allowed as CREATE DATABASE template? */ bool datallowconn; /* new connections allowed? */ - int4 datconnlimit; /* max connections allowed (-1=no limit) */ + int32 datconnlimit; /* max connections allowed (-1=no limit) */ Oid datlastsysoid; /* highest OID to consider a system OID */ TransactionId datfrozenxid; /* all Xids < this are frozen in this DB */ + TransactionId datminmxid; /* all multixacts in the DB are >= this */ Oid dattablespace; /* default table space for this DB */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ @@ -59,7 +60,7 @@ typedef FormData_pg_database *Form_pg_database; * compiler constants for pg_database * ---------------- */ -#define Natts_pg_database 12 +#define Natts_pg_database 13 #define Anum_pg_database_datname 1 #define Anum_pg_database_datdba 2 #define Anum_pg_database_encoding 3 @@ -70,10 +71,11 @@ typedef FormData_pg_database *Form_pg_database; #define Anum_pg_database_datconnlimit 8 #define Anum_pg_database_datlastsysoid 9 #define Anum_pg_database_datfrozenxid 10 -#define Anum_pg_database_dattablespace 11 -#define Anum_pg_database_datacl 12 +#define Anum_pg_database_datminmxid 11 +#define Anum_pg_database_dattablespace 12 +#define Anum_pg_database_datacl 13 -DATA(insert OID = 1 ( template1 PGUID ENCODING "LC_COLLATE" "LC_CTYPE" t t -1 0 0 1663 _null_)); +DATA(insert OID = 1 ( template1 PGUID ENCODING "LC_COLLATE" "LC_CTYPE" t t -1 0 0 1 1663 _null_)); SHDESCR("default template for new databases"); #define TemplateDbOid 1 diff --git a/src/include/catalog/pg_db_role_setting.h b/src/include/catalog/pg_db_role_setting.h index c6a69c5a6d..054e87a0dd 100644 --- a/src/include/catalog/pg_db_role_setting.h +++ b/src/include/catalog/pg_db_role_setting.h @@ -4,7 +4,7 @@ * definition of configuration settings * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_db_role_setting.h @@ -23,9 +23,10 @@ #include "utils/guc.h" #include "utils/relcache.h" +#include "utils/snapshot.h" /* ---------------- - * pg_db_role_setting definition. cpp turns this into + * pg_db_role_setting definition. cpp turns this into * typedef struct FormData_pg_db_role_setting * ---------------- */ @@ -62,7 +63,7 @@ typedef FormData_pg_db_role_setting *Form_pg_db_role_setting; */ extern void AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt); extern void DropSetting(Oid databaseid, Oid roleid); -extern void ApplySetting(Oid databaseid, Oid roleid, Relation relsetting, - GucSource source); +extern void ApplySetting(Snapshot snapshot, Oid databaseid, Oid roleid, + Relation relsetting, GucSource source); #endif /* PG_DB_ROLE_SETTING_H */ diff --git a/src/include/catalog/pg_default_acl.h b/src/include/catalog/pg_default_acl.h index d7421007af..749e2e431d 100644 --- a/src/include/catalog/pg_default_acl.h +++ b/src/include/catalog/pg_default_acl.h @@ -4,7 +4,7 @@ * definition of default ACLs for new objects. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_default_acl.h @@ -21,7 +21,7 @@ #include "catalog/genbki.h" /* ---------------- - * pg_default_acl definition. cpp turns this into + * pg_default_acl definition. cpp turns this into * typedef struct FormData_pg_default_acl * ---------------- */ @@ -63,7 +63,7 @@ typedef FormData_pg_default_acl *Form_pg_default_acl; /* * Types of objects for which the user is allowed to specify default - * permissions through pg_default_acl. These codes are used in the + * permissions through pg_default_acl. These codes are used in the * defaclobjtype column. */ #define DEFACLOBJ_RELATION 'r' /* table, view */ diff --git a/src/include/catalog/pg_depend.h b/src/include/catalog/pg_depend.h index e56dd1ad3d..207694211b 100644 --- a/src/include/catalog/pg_depend.h +++ b/src/include/catalog/pg_depend.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_depend.h @@ -37,14 +37,14 @@ CATALOG(pg_depend,2608) BKI_WITHOUT_OIDS */ Oid classid; /* OID of table containing object */ Oid objid; /* OID of object itself */ - int4 objsubid; /* column number, or 0 if not used */ + int32 objsubid; /* column number, or 0 if not used */ /* * Identification of the independent (referenced) object. */ Oid refclassid; /* OID of table containing object */ Oid refobjid; /* OID of object itself */ - int4 refobjsubid; /* column number, or 0 if not used */ + int32 refobjsubid; /* column number, or 0 if not used */ /* * Precise semantics of the relationship are specified by the deptype diff --git a/src/include/catalog/pg_description.h b/src/include/catalog/pg_description.h index a454194893..b5f23b808f 100644 --- a/src/include/catalog/pg_description.h +++ b/src/include/catalog/pg_description.h @@ -6,12 +6,12 @@ * NOTE: an object is identified by the OID of the row that primarily * defines the object, plus the OID of the table that that row appears in. * For example, a function is identified by the OID of its pg_proc row - * plus the pg_class OID of table pg_proc. This allows unique identification + * plus the pg_class OID of table pg_proc. This allows unique identification * of objects without assuming that OIDs are unique across tables. * * Since attributes don't have OIDs of their own, we identify an attribute * comment by the objoid+classoid of its parent table, plus an "objsubid" - * giving the attribute column number. "objsubid" must be zero in a comment + * giving the attribute column number. "objsubid" must be zero in a comment * for a table itself, so that it is distinct from any column comment. * Currently, objsubid is unused and zero for all other kinds of objects, * but perhaps it might be useful someday to associate comments with @@ -19,7 +19,7 @@ * for example). * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_description.h @@ -39,7 +39,7 @@ #include "catalog/genbki.h" /* ---------------- - * pg_description definition. cpp turns this into + * pg_description definition. cpp turns this into * typedef struct FormData_pg_description * ---------------- */ @@ -49,7 +49,7 @@ CATALOG(pg_description,2609) BKI_WITHOUT_OIDS { Oid objoid; /* OID of object itself */ Oid classoid; /* OID of table containing object */ - int4 objsubid; /* column number, or 0 if not used */ + int32 objsubid; /* column number, or 0 if not used */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text description; /* description of object */ diff --git a/src/include/catalog/pg_enum.h b/src/include/catalog/pg_enum.h index 91c1ab1de7..b50addb76d 100644 --- a/src/include/catalog/pg_enum.h +++ b/src/include/catalog/pg_enum.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Copyright (c) 2006-2012, PostgreSQL Global Development Group + * Copyright (c) 2006-2014, PostgreSQL Global Development Group * * src/include/catalog/pg_enum.h * @@ -65,6 +65,7 @@ typedef FormData_pg_enum *Form_pg_enum; extern void EnumValuesCreate(Oid enumTypeOid, List *vals); extern void EnumValuesDelete(Oid enumTypeOid); extern void AddEnumLabel(Oid enumTypeOid, const char *newVal, - const char *neighbor, bool newValIsAfter); + const char *neighbor, bool newValIsAfter, + bool skipIfExists); #endif /* PG_ENUM_H */ diff --git a/src/include/catalog/pg_event_trigger.h b/src/include/catalog/pg_event_trigger.h new file mode 100644 index 0000000000..1284b88cec --- /dev/null +++ b/src/include/catalog/pg_event_trigger.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * pg_event_trigger.h + * definition of the system "event trigger" relation (pg_event_trigger) + * along with the relation's initial contents. + * + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_event_trigger.h + * + * NOTES + * the genbki.pl script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_EVENT_TRIGGER_H +#define PG_EVENT_TRIGGER_H + +#include "catalog/genbki.h" + +/* ---------------- + * pg_event_trigger definition. cpp turns this into + * typedef struct FormData_pg_event_trigger + * ---------------- + */ +#define EventTriggerRelationId 3466 + +CATALOG(pg_event_trigger,3466) +{ + NameData evtname; /* trigger's name */ + NameData evtevent; /* trigger's event */ + Oid evtowner; /* trigger's owner */ + Oid evtfoid; /* OID of function to be called */ + char evtenabled; /* trigger's firing configuration WRT + * session_replication_role */ + +#ifdef CATALOG_VARLEN + text evttags[1]; /* command TAGs this event trigger targets */ +#endif +} FormData_pg_event_trigger; + +/* ---------------- + * Form_pg_event_trigger corresponds to a pointer to a tuple with + * the format of pg_event_trigger relation. + * ---------------- + */ +typedef FormData_pg_event_trigger *Form_pg_event_trigger; + +/* ---------------- + * compiler constants for pg_event_trigger + * ---------------- + */ +#define Natts_pg_event_trigger 6 +#define Anum_pg_event_trigger_evtname 1 +#define Anum_pg_event_trigger_evtevent 2 +#define Anum_pg_event_trigger_evtowner 3 +#define Anum_pg_event_trigger_evtfoid 4 +#define Anum_pg_event_trigger_evtenabled 5 +#define Anum_pg_event_trigger_evttags 6 + +#endif /* PG_EVENT_TRIGGER_H */ diff --git a/src/include/catalog/pg_extension.h b/src/include/catalog/pg_extension.h index 4807c6a733..15b24eb8db 100644 --- a/src/include/catalog/pg_extension.h +++ b/src/include/catalog/pg_extension.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_extension.h diff --git a/src/include/catalog/pg_foreign_data_wrapper.h b/src/include/catalog/pg_foreign_data_wrapper.h index 18c538f49c..9ad25d8061 100644 --- a/src/include/catalog/pg_foreign_data_wrapper.h +++ b/src/include/catalog/pg_foreign_data_wrapper.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_foreign_data_wrapper.h diff --git a/src/include/catalog/pg_foreign_server.h b/src/include/catalog/pg_foreign_server.h index 38830af29e..d57e672661 100644 --- a/src/include/catalog/pg_foreign_server.h +++ b/src/include/catalog/pg_foreign_server.h @@ -3,7 +3,7 @@ * pg_foreign_server.h * definition of the system "foreign server" relation (pg_foreign_server) * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_foreign_server.h diff --git a/src/include/catalog/pg_foreign_table.h b/src/include/catalog/pg_foreign_table.h index 186c49d425..50b17a1146 100644 --- a/src/include/catalog/pg_foreign_table.h +++ b/src/include/catalog/pg_foreign_table.h @@ -3,7 +3,7 @@ * pg_foreign_table.h * definition of the system "foreign table" relation (pg_foreign_table) * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_foreign_table.h diff --git a/src/include/catalog/pg_index.h b/src/include/catalog/pg_index.h index 9a86121cf9..8b8be3bfbf 100644 --- a/src/include/catalog/pg_index.h +++ b/src/include/catalog/pg_index.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_index.h @@ -32,7 +32,7 @@ CATALOG(pg_index,2610) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO { Oid indexrelid; /* OID of the index */ Oid indrelid; /* OID of the relation it indexes */ - int2 indnatts; /* number of columns in index */ + int16 indnatts; /* number of columns in index */ bool indisunique; /* is this a unique index? */ bool indisprimary; /* is this index for primary key? */ bool indisexclusion; /* is this index for exclusion constraint? */ @@ -41,6 +41,8 @@ CATALOG(pg_index,2610) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO bool indisvalid; /* is this index valid for use by queries? */ bool indcheckxmin; /* must we wait for xmin to be old? */ bool indisready; /* is this index ready for inserts? */ + bool indislive; /* is this index alive at all? */ + bool indisreplident; /* is this index the identity for replication? */ /* variable-length fields start here, but we allow direct access to indkey */ int2vector indkey; /* column numbers of indexed cols, or 0 */ @@ -68,7 +70,7 @@ typedef FormData_pg_index *Form_pg_index; * compiler constants for pg_index * ---------------- */ -#define Natts_pg_index 17 +#define Natts_pg_index 19 #define Anum_pg_index_indexrelid 1 #define Anum_pg_index_indrelid 2 #define Anum_pg_index_indnatts 3 @@ -80,12 +82,14 @@ typedef FormData_pg_index *Form_pg_index; #define Anum_pg_index_indisvalid 9 #define Anum_pg_index_indcheckxmin 10 #define Anum_pg_index_indisready 11 -#define Anum_pg_index_indkey 12 -#define Anum_pg_index_indcollation 13 -#define Anum_pg_index_indclass 14 -#define Anum_pg_index_indoption 15 -#define Anum_pg_index_indexprs 16 -#define Anum_pg_index_indpred 17 +#define Anum_pg_index_indislive 12 +#define Anum_pg_index_indisreplident 13 +#define Anum_pg_index_indkey 14 +#define Anum_pg_index_indcollation 15 +#define Anum_pg_index_indclass 16 +#define Anum_pg_index_indoption 17 +#define Anum_pg_index_indexprs 18 +#define Anum_pg_index_indpred 19 /* * Index AMs that support ordered scans must support these two indoption @@ -95,4 +99,13 @@ typedef FormData_pg_index *Form_pg_index; #define INDOPTION_DESC 0x0001 /* values are in reverse order */ #define INDOPTION_NULLS_FIRST 0x0002 /* NULLs are first instead of last */ +/* + * Use of these macros is recommended over direct examination of the state + * flag columns where possible; this allows source code compatibility with + * the hacky representation used in 9.2. + */ +#define IndexIsValid(indexForm) ((indexForm)->indisvalid) +#define IndexIsReady(indexForm) ((indexForm)->indisready) +#define IndexIsLive(indexForm) ((indexForm)->indislive) + #endif /* PG_INDEX_H */ diff --git a/src/include/catalog/pg_inherits.h b/src/include/catalog/pg_inherits.h index 18552bde7e..cda48f2519 100644 --- a/src/include/catalog/pg_inherits.h +++ b/src/include/catalog/pg_inherits.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_inherits.h @@ -32,7 +32,7 @@ CATALOG(pg_inherits,2611) BKI_WITHOUT_OIDS { Oid inhrelid; Oid inhparent; - int4 inhseqno; + int32 inhseqno; } FormData_pg_inherits; /* ---------------- diff --git a/src/include/catalog/pg_inherits_fn.h b/src/include/catalog/pg_inherits_fn.h index 9484b41dec..757d8499e1 100644 --- a/src/include/catalog/pg_inherits_fn.h +++ b/src/include/catalog/pg_inherits_fn.h @@ -4,7 +4,7 @@ * prototypes for functions in catalog/pg_inherits.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_inherits_fn.h diff --git a/src/include/catalog/pg_language.h b/src/include/catalog/pg_language.h index 79cfa09d02..4032fe080e 100644 --- a/src/include/catalog/pg_language.h +++ b/src/include/catalog/pg_language.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_language.h diff --git a/src/include/catalog/pg_largeobject.h b/src/include/catalog/pg_largeobject.h index d442ec4e4a..b341f92eb7 100644 --- a/src/include/catalog/pg_largeobject.h +++ b/src/include/catalog/pg_largeobject.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_largeobject.h @@ -22,7 +22,7 @@ #include "catalog/genbki.h" /* ---------------- - * pg_largeobject definition. cpp turns this into + * pg_largeobject definition. cpp turns this into * typedef struct FormData_pg_largeobject * ---------------- */ @@ -31,7 +31,7 @@ CATALOG(pg_largeobject,2613) BKI_WITHOUT_OIDS { Oid loid; /* Identifier of large object */ - int4 pageno; /* Page number (starting from 0) */ + int32 pageno; /* Page number (starting from 0) */ /* data has variable length, but we allow direct access; see inv_api.c */ bytea data; /* Data for page (may be zero-length) */ @@ -55,7 +55,6 @@ typedef FormData_pg_largeobject *Form_pg_largeobject; extern Oid LargeObjectCreate(Oid loid); extern void LargeObjectDrop(Oid loid); -extern void LargeObjectAlterOwner(Oid loid, Oid newOwnerId); extern bool LargeObjectExists(Oid loid); #endif /* PG_LARGEOBJECT_H */ diff --git a/src/include/catalog/pg_largeobject_metadata.h b/src/include/catalog/pg_largeobject_metadata.h index 768497eb52..9f4f63267c 100644 --- a/src/include/catalog/pg_largeobject_metadata.h +++ b/src/include/catalog/pg_largeobject_metadata.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_largeobject_metadata.h diff --git a/src/include/catalog/pg_namespace.h b/src/include/catalog/pg_namespace.h index 2e63e8dd6b..e58ef3aa21 100644 --- a/src/include/catalog/pg_namespace.h +++ b/src/include/catalog/pg_namespace.h @@ -10,7 +10,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_namespace.h diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h index 638f8088c7..dc523416c9 100644 --- a/src/include/catalog/pg_opclass.h +++ b/src/include/catalog/pg_opclass.h @@ -17,15 +17,15 @@ * don't support partial indexes on system catalogs.) * * Normally opckeytype = InvalidOid (zero), indicating that the data stored - * in the index is the same as the data in the indexed column. If opckeytype + * in the index is the same as the data in the indexed column. If opckeytype * is nonzero then it indicates that a conversion step is needed to produce * the stored index data, which will be of type opckeytype (which might be - * the same or different from the input datatype). Performing such a + * the same or different from the input datatype). Performing such a * conversion is the responsibility of the index access method --- not all * AMs support this. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_opclass.h @@ -42,7 +42,7 @@ #include "catalog/genbki.h" /* ---------------- - * pg_opclass definition. cpp turns this into + * pg_opclass definition. cpp turns this into * typedef struct FormData_pg_opclass * ---------------- */ @@ -112,6 +112,7 @@ DATA(insert OID = 3123 ( 403 float8_ops PGNSP PGUID 1970 701 t 0 )); DATA(insert ( 405 float8_ops PGNSP PGUID 1971 701 t 0 )); DATA(insert ( 403 inet_ops PGNSP PGUID 1974 869 t 0 )); DATA(insert ( 405 inet_ops PGNSP PGUID 1975 869 t 0 )); +DATA(insert ( 783 inet_ops PGNSP PGUID 3550 869 f 0 )); DATA(insert OID = 1979 ( 403 int2_ops PGNSP PGUID 1976 21 t 0 )); #define INT2_BTREE_OPS_OID 1979 DATA(insert ( 405 int2_ops PGNSP PGUID 1977 21 t 0 )); @@ -143,6 +144,7 @@ DATA(insert ( 405 oid_ops PGNSP PGUID 1990 26 t 0 )); DATA(insert ( 403 oidvector_ops PGNSP PGUID 1991 30 t 0 )); DATA(insert ( 405 oidvector_ops PGNSP PGUID 1992 30 t 0 )); DATA(insert ( 403 record_ops PGNSP PGUID 2994 2249 t 0 )); +DATA(insert ( 403 record_image_ops PGNSP PGUID 3194 2249 f 0 )); DATA(insert OID = 3126 ( 403 text_ops PGNSP PGUID 1994 25 t 0 )); #define TEXT_BTREE_OPS_OID 3126 DATA(insert ( 405 text_ops PGNSP PGUID 1995 25 t 0 )); @@ -213,6 +215,8 @@ DATA(insert ( 2742 _reltime_ops PGNSP PGUID 2745 1024 t 703 )); DATA(insert ( 2742 _tinterval_ops PGNSP PGUID 2745 1025 t 704 )); DATA(insert ( 403 uuid_ops PGNSP PGUID 2968 2950 t 0 )); DATA(insert ( 405 uuid_ops PGNSP PGUID 2969 2950 t 0 )); +DATA(insert ( 403 pg_lsn_ops PGNSP PGUID 3253 3220 t 0 )); +DATA(insert ( 405 pg_lsn_ops PGNSP PGUID 3254 3220 t 0 )); DATA(insert ( 403 enum_ops PGNSP PGUID 3522 3500 t 0 )); DATA(insert ( 405 enum_ops PGNSP PGUID 3523 3500 t 0 )); DATA(insert ( 403 tsvector_ops PGNSP PGUID 3626 3614 t 0 )); @@ -223,8 +227,13 @@ DATA(insert ( 783 tsquery_ops PGNSP PGUID 3702 3615 t 20 )); DATA(insert ( 403 range_ops PGNSP PGUID 3901 3831 t 0 )); DATA(insert ( 405 range_ops PGNSP PGUID 3903 3831 t 0 )); DATA(insert ( 783 range_ops PGNSP PGUID 3919 3831 t 0 )); +DATA(insert ( 4000 range_ops PGNSP PGUID 3474 3831 t 0 )); DATA(insert ( 4000 quad_point_ops PGNSP PGUID 4015 600 t 0 )); DATA(insert ( 4000 kd_point_ops PGNSP PGUID 4016 600 f 0 )); DATA(insert ( 4000 text_ops PGNSP PGUID 4017 25 t 0 )); +DATA(insert ( 403 jsonb_ops PGNSP PGUID 4033 3802 t 0 )); +DATA(insert ( 405 jsonb_ops PGNSP PGUID 4034 3802 t 0 )); +DATA(insert ( 2742 jsonb_ops PGNSP PGUID 4036 3802 t 25 )); +DATA(insert ( 2742 jsonb_path_ops PGNSP PGUID 4037 3802 f 23 )); #endif /* PG_OPCLASS_H */ diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h index 94702541f5..87ee4eb852 100644 --- a/src/include/catalog/pg_operator.h +++ b/src/include/catalog/pg_operator.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_operator.h @@ -128,8 +128,10 @@ DATA(insert OID = 95 ( "<" PGNSP PGUID b f f 21 21 16 520 524 int2lt scalar DESCR("less than"); DATA(insert OID = 96 ( "=" PGNSP PGUID b t t 23 23 16 96 518 int4eq eqsel eqjoinsel )); DESCR("equal"); +#define Int4EqualOperator 96 DATA(insert OID = 97 ( "<" PGNSP PGUID b f f 23 23 16 521 525 int4lt scalarltsel scalarltjoinsel )); DESCR("less than"); +#define Int4LessOperator 97 DATA(insert OID = 98 ( "=" PGNSP PGUID b t t 25 25 16 98 531 texteq eqsel eqjoinsel )); DESCR("equal"); #define TextEqualOperator 98 @@ -175,6 +177,7 @@ DATA(insert OID = 411 ( "<>" PGNSP PGUID b f f 20 20 16 411 410 int8ne neqsel DESCR("not equal"); DATA(insert OID = 412 ( "<" PGNSP PGUID b f f 20 20 16 413 415 int8lt scalarltsel scalarltjoinsel )); DESCR("less than"); +#define Int8LessOperator 412 DATA(insert OID = 413 ( ">" PGNSP PGUID b f f 20 20 16 412 414 int8gt scalargtsel scalargtjoinsel )); DESCR("greater than"); DATA(insert OID = 414 ( "<=" PGNSP PGUID b f f 20 20 16 415 413 int8le scalarltsel scalarltjoinsel )); @@ -527,6 +530,7 @@ DATA(insert OID = 671 ( "<>" PGNSP PGUID b f f 701 701 16 671 670 float8ne DESCR("not equal"); DATA(insert OID = 672 ( "<" PGNSP PGUID b f f 701 701 16 674 675 float8lt scalarltsel scalarltjoinsel )); DESCR("less than"); +#define Float8LessOperator 672 DATA(insert OID = 673 ( "<=" PGNSP PGUID b f f 701 701 16 675 674 float8le scalarltsel scalarltjoinsel )); DESCR("less than or equal"); DATA(insert OID = 674 ( ">" PGNSP PGUID b f f 701 701 16 672 673 float8gt scalargtsel scalargtjoinsel )); @@ -1136,18 +1140,20 @@ DATA(insert OID = 1205 ( ">" PGNSP PGUID b f f 869 869 16 1203 1204 network DESCR("greater than"); DATA(insert OID = 1206 ( ">=" PGNSP PGUID b f f 869 869 16 1204 1203 network_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); -DATA(insert OID = 931 ( "<<" PGNSP PGUID b f f 869 869 16 933 0 network_sub - - )); +DATA(insert OID = 931 ( "<<" PGNSP PGUID b f f 869 869 16 933 0 network_sub networksel networkjoinsel )); DESCR("is subnet"); #define OID_INET_SUB_OP 931 -DATA(insert OID = 932 ( "<<=" PGNSP PGUID b f f 869 869 16 934 0 network_subeq - - )); +DATA(insert OID = 932 ( "<<=" PGNSP PGUID b f f 869 869 16 934 0 network_subeq networksel networkjoinsel )); DESCR("is subnet or equal"); #define OID_INET_SUBEQ_OP 932 -DATA(insert OID = 933 ( ">>" PGNSP PGUID b f f 869 869 16 931 0 network_sup - - )); +DATA(insert OID = 933 ( ">>" PGNSP PGUID b f f 869 869 16 931 0 network_sup networksel networkjoinsel )); DESCR("is supernet"); #define OID_INET_SUP_OP 933 -DATA(insert OID = 934 ( ">>=" PGNSP PGUID b f f 869 869 16 932 0 network_supeq - - )); +DATA(insert OID = 934 ( ">>=" PGNSP PGUID b f f 869 869 16 932 0 network_supeq networksel networkjoinsel )); DESCR("is supernet or equal"); #define OID_INET_SUPEQ_OP 934 +DATA(insert OID = 3552 ( "&&" PGNSP PGUID b f f 869 869 16 3552 0 network_overlap networksel networkjoinsel )); +DESCR("overlaps (is subnet or supernet)"); DATA(insert OID = 2634 ( "~" PGNSP PGUID l f f 0 869 869 0 0 inetnot - - )); DESCR("bitwise not"); @@ -1588,6 +1594,22 @@ DESCR("less than or equal"); DATA(insert OID = 2977 ( ">=" PGNSP PGUID b f f 2950 2950 16 2976 2974 uuid_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); +/* pg_lsn operators */ +DATA(insert OID = 3222 ( "=" PGNSP PGUID b t t 3220 3220 16 3222 3223 pg_lsn_eq eqsel eqjoinsel )); +DESCR("equal"); +DATA(insert OID = 3223 ( "<>" PGNSP PGUID b f f 3220 3220 16 3223 3222 pg_lsn_ne neqsel neqjoinsel )); +DESCR("not equal"); +DATA(insert OID = 3224 ( "<" PGNSP PGUID b f f 3220 3220 16 3225 3227 pg_lsn_lt scalarltsel scalarltjoinsel )); +DESCR("less than"); +DATA(insert OID = 3225 ( ">" PGNSP PGUID b f f 3220 3220 16 3224 3226 pg_lsn_gt scalargtsel scalargtjoinsel )); +DESCR("greater than"); +DATA(insert OID = 3226 ( "<=" PGNSP PGUID b f f 3220 3220 16 3227 3225 pg_lsn_le scalarltsel scalarltjoinsel )); +DESCR("less than or equal"); +DATA(insert OID = 3227 ( ">=" PGNSP PGUID b f f 3220 3220 16 3226 3224 pg_lsn_ge scalargtsel scalargtjoinsel )); +DESCR("greater than or equal"); +DATA(insert OID = 3228 ( "-" PGNSP PGUID b f f 3220 3220 1700 0 0 pg_lsn_mi - - )); +DESCR("minus"); + /* enum operators */ DATA(insert OID = 3516 ( "=" PGNSP PGUID b t t 3500 3500 16 3516 3517 enum_eq eqsel eqjoinsel )); DESCR("equal"); @@ -1671,37 +1693,64 @@ DESCR("less than or equal"); DATA(insert OID = 2993 ( ">=" PGNSP PGUID b f f 2249 2249 16 2992 2990 record_ge scalargtsel scalargtjoinsel )); DESCR("greater than or equal"); +/* byte-oriented tests for identical rows and fast sorting */ +DATA(insert OID = 3188 ( "*=" PGNSP PGUID b t f 2249 2249 16 3188 3189 record_image_eq eqsel eqjoinsel )); +DESCR("identical"); +DATA(insert OID = 3189 ( "*<>" PGNSP PGUID b f f 2249 2249 16 3189 3188 record_image_ne neqsel neqjoinsel )); +DESCR("not identical"); +DATA(insert OID = 3190 ( "*<" PGNSP PGUID b f f 2249 2249 16 3191 3193 record_image_lt scalarltsel scalarltjoinsel )); +DESCR("less than"); +DATA(insert OID = 3191 ( "*>" PGNSP PGUID b f f 2249 2249 16 3190 3192 record_image_gt scalargtsel scalargtjoinsel )); +DESCR("greater than"); +DATA(insert OID = 3192 ( "*<=" PGNSP PGUID b f f 2249 2249 16 3193 3191 record_image_le scalarltsel scalarltjoinsel )); +DESCR("less than or equal"); +DATA(insert OID = 3193 ( "*>=" PGNSP PGUID b f f 2249 2249 16 3192 3190 record_image_ge scalargtsel scalargtjoinsel )); +DESCR("greater than or equal"); + /* generic range type operators */ DATA(insert OID = 3882 ( "=" PGNSP PGUID b t t 3831 3831 16 3882 3883 range_eq eqsel eqjoinsel )); DESCR("equal"); DATA(insert OID = 3883 ( "<>" PGNSP PGUID b f f 3831 3831 16 3883 3882 range_ne neqsel neqjoinsel )); DESCR("not equal"); -DATA(insert OID = 3884 ( "<" PGNSP PGUID b f f 3831 3831 16 3887 3886 range_lt scalarltsel scalarltjoinsel )); +DATA(insert OID = 3884 ( "<" PGNSP PGUID b f f 3831 3831 16 3887 3886 range_lt rangesel scalarltjoinsel )); DESCR("less than"); -DATA(insert OID = 3885 ( "<=" PGNSP PGUID b f f 3831 3831 16 3886 3887 range_le scalarltsel scalarltjoinsel )); +#define OID_RANGE_LESS_OP 3884 +DATA(insert OID = 3885 ( "<=" PGNSP PGUID b f f 3831 3831 16 3886 3887 range_le rangesel scalarltjoinsel )); DESCR("less than or equal"); -DATA(insert OID = 3886 ( ">=" PGNSP PGUID b f f 3831 3831 16 3885 3884 range_ge scalargtsel scalargtjoinsel )); +#define OID_RANGE_LESS_EQUAL_OP 3885 +DATA(insert OID = 3886 ( ">=" PGNSP PGUID b f f 3831 3831 16 3885 3884 range_ge rangesel scalargtjoinsel )); DESCR("greater than or equal"); -DATA(insert OID = 3887 ( ">" PGNSP PGUID b f f 3831 3831 16 3884 3885 range_gt scalargtsel scalargtjoinsel )); +#define OID_RANGE_GREATER_OP 3886 +DATA(insert OID = 3887 ( ">" PGNSP PGUID b f f 3831 3831 16 3884 3885 range_gt rangesel scalargtjoinsel )); DESCR("greater than"); -DATA(insert OID = 3888 ( "&&" PGNSP PGUID b f f 3831 3831 16 3888 0 range_overlaps areasel areajoinsel )); +#define OID_RANGE_GREATER_EQUAL_OP 3887 +DATA(insert OID = 3888 ( "&&" PGNSP PGUID b f f 3831 3831 16 3888 0 range_overlaps rangesel areajoinsel )); DESCR("overlaps"); -DATA(insert OID = 3889 ( "@>" PGNSP PGUID b f f 3831 2283 16 3891 0 range_contains_elem contsel contjoinsel )); +#define OID_RANGE_OVERLAP_OP 3888 +DATA(insert OID = 3889 ( "@>" PGNSP PGUID b f f 3831 2283 16 3891 0 range_contains_elem rangesel contjoinsel )); DESCR("contains"); -DATA(insert OID = 3890 ( "@>" PGNSP PGUID b f f 3831 3831 16 3892 0 range_contains contsel contjoinsel )); +#define OID_RANGE_CONTAINS_ELEM_OP 3889 +DATA(insert OID = 3890 ( "@>" PGNSP PGUID b f f 3831 3831 16 3892 0 range_contains rangesel contjoinsel )); DESCR("contains"); -DATA(insert OID = 3891 ( "<@" PGNSP PGUID b f f 2283 3831 16 3889 0 elem_contained_by_range contsel contjoinsel )); +#define OID_RANGE_CONTAINS_OP 3890 +DATA(insert OID = 3891 ( "<@" PGNSP PGUID b f f 2283 3831 16 3889 0 elem_contained_by_range rangesel contjoinsel )); DESCR("is contained by"); -DATA(insert OID = 3892 ( "<@" PGNSP PGUID b f f 3831 3831 16 3890 0 range_contained_by contsel contjoinsel )); +#define OID_RANGE_ELEM_CONTAINED_OP 3891 +DATA(insert OID = 3892 ( "<@" PGNSP PGUID b f f 3831 3831 16 3890 0 range_contained_by rangesel contjoinsel )); DESCR("is contained by"); -DATA(insert OID = 3893 ( "<<" PGNSP PGUID b f f 3831 3831 16 3894 0 range_before scalarltsel scalarltjoinsel )); +#define OID_RANGE_CONTAINED_OP 3892 +DATA(insert OID = 3893 ( "<<" PGNSP PGUID b f f 3831 3831 16 3894 0 range_before rangesel scalarltjoinsel )); DESCR("is left of"); -DATA(insert OID = 3894 ( ">>" PGNSP PGUID b f f 3831 3831 16 3893 0 range_after scalargtsel scalargtjoinsel )); +#define OID_RANGE_LEFT_OP 3893 +DATA(insert OID = 3894 ( ">>" PGNSP PGUID b f f 3831 3831 16 3893 0 range_after rangesel scalargtjoinsel )); DESCR("is right of"); -DATA(insert OID = 3895 ( "&<" PGNSP PGUID b f f 3831 3831 16 0 0 range_overleft scalarltsel scalarltjoinsel )); +#define OID_RANGE_RIGHT_OP 3894 +DATA(insert OID = 3895 ( "&<" PGNSP PGUID b f f 3831 3831 16 0 0 range_overleft rangesel scalarltjoinsel )); DESCR("overlaps or is left of"); -DATA(insert OID = 3896 ( "&>" PGNSP PGUID b f f 3831 3831 16 0 0 range_overright scalargtsel scalargtjoinsel )); +#define OID_RANGE_OVERLAPS_LEFT_OP 3895 +DATA(insert OID = 3896 ( "&>" PGNSP PGUID b f f 3831 3831 16 0 0 range_overright rangesel scalargtjoinsel )); DESCR("overlaps or is right of"); +#define OID_RANGE_OVERLAPS_RIGHT_OP 3896 DATA(insert OID = 3897 ( "-|-" PGNSP PGUID b f f 3831 3831 16 3897 0 range_adjacent contsel contjoinsel )); DESCR("is adjacent to"); DATA(insert OID = 3898 ( "+" PGNSP PGUID b f f 3831 3831 3831 3898 0 range_union - - )); @@ -1710,12 +1759,58 @@ DATA(insert OID = 3899 ( "-" PGNSP PGUID b f f 3831 3831 3831 0 0 range_minu DESCR("range difference"); DATA(insert OID = 3900 ( "*" PGNSP PGUID b f f 3831 3831 3831 3900 0 range_intersect - - )); DESCR("range intersection"); - +DATA(insert OID = 3962 ( "->" PGNSP PGUID b f f 114 25 114 0 0 json_object_field - - )); +DESCR("get json object field"); +DATA(insert OID = 3963 ( "->>" PGNSP PGUID b f f 114 25 25 0 0 json_object_field_text - - )); +DESCR("get json object field as text"); +DATA(insert OID = 3964 ( "->" PGNSP PGUID b f f 114 23 114 0 0 json_array_element - - )); +DESCR("get json array element"); +DATA(insert OID = 3965 ( "->>" PGNSP PGUID b f f 114 23 25 0 0 json_array_element_text - - )); +DESCR("get json array element as text"); +DATA(insert OID = 3966 ( "#>" PGNSP PGUID b f f 114 1009 114 0 0 json_extract_path_op - - )); +DESCR("get value from json with path elements"); +DATA(insert OID = 3967 ( "#>>" PGNSP PGUID b f f 114 1009 25 0 0 json_extract_path_text_op - - )); +DESCR("get value from json as text with path elements"); +DATA(insert OID = 3211 ( "->" PGNSP PGUID b f f 3802 25 3802 0 0 jsonb_object_field - - )); +DESCR("get jsonb object field"); +DATA(insert OID = 3477 ( "->>" PGNSP PGUID b f f 3802 25 25 0 0 jsonb_object_field_text - - )); +DESCR("get jsonb object field as text"); +DATA(insert OID = 3212 ( "->" PGNSP PGUID b f f 3802 23 3802 0 0 jsonb_array_element - - )); +DESCR("get jsonb array element"); +DATA(insert OID = 3481 ( "->>" PGNSP PGUID b f f 3802 23 25 0 0 jsonb_array_element_text - - )); +DESCR("get jsonb array element as text"); +DATA(insert OID = 3213 ( "#>" PGNSP PGUID b f f 3802 1009 3802 0 0 jsonb_extract_path_op - - )); +DESCR("get value from jsonb with path elements"); +DATA(insert OID = 3206 ( "#>>" PGNSP PGUID b f f 3802 1009 25 0 0 jsonb_extract_path_text_op - - )); +DESCR("get value from jsonb as text with path elements"); +DATA(insert OID = 3240 ( "=" PGNSP PGUID b t t 3802 3802 16 3240 3241 jsonb_eq eqsel eqjoinsel )); +DESCR("equal"); +DATA(insert OID = 3241 ( "<>" PGNSP PGUID b f f 3802 3802 16 3241 3240 jsonb_ne neqsel neqjoinsel )); +DESCR("not equal"); +DATA(insert OID = 3242 ( "<" PGNSP PGUID b f f 3802 3802 16 3243 3245 jsonb_lt scalarltsel scalarltjoinsel )); +DESCR("less than"); +DATA(insert OID = 3243 ( ">" PGNSP PGUID b f f 3802 3802 16 3242 3244 jsonb_gt scalargtsel scalargtjoinsel )); +DESCR("greater than"); +DATA(insert OID = 3244 ( "<=" PGNSP PGUID b f f 3802 3802 16 3245 3243 jsonb_le scalarltsel scalarltjoinsel )); +DESCR("less than or equal to"); +DATA(insert OID = 3245 ( ">=" PGNSP PGUID b f f 3802 3802 16 3244 3242 jsonb_ge scalargtsel scalargtjoinsel )); +DESCR("greater than or equal to"); +/* No commutator? */ +DATA(insert OID = 3246 ( "@>" PGNSP PGUID b f f 3802 3802 16 0 3250 jsonb_contains contsel contjoinsel )); +DESCR("contains"); +DATA(insert OID = 3247 ( "?" PGNSP PGUID b f f 3802 25 16 0 0 jsonb_exists contsel contjoinsel )); +DESCR("exists"); +DATA(insert OID = 3248 ( "?|" PGNSP PGUID b f f 3802 1009 16 0 0 jsonb_exists_any contsel contjoinsel )); +DESCR("exists any"); +DATA(insert OID = 3249 ( "?&" PGNSP PGUID b f f 3802 1009 16 0 0 jsonb_exists_all contsel contjoinsel )); +DESCR("exists all"); +DATA(insert OID = 3250 ( "<@" PGNSP PGUID b f f 3802 3802 16 0 3246 jsonb_contained contsel contjoinsel )); +DESCR("contained"); /* * function prototypes */ -extern void OperatorCreate(const char *operatorName, +extern Oid OperatorCreate(const char *operatorName, Oid operatorNamespace, Oid leftTypeId, Oid rightTypeId, diff --git a/src/include/catalog/pg_opfamily.h b/src/include/catalog/pg_opfamily.h index 41ebccccbc..26297ced0d 100644 --- a/src/include/catalog/pg_opfamily.h +++ b/src/include/catalog/pg_opfamily.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_opfamily.h @@ -78,6 +78,7 @@ DATA(insert OID = 1971 ( 405 float_ops PGNSP PGUID )); DATA(insert OID = 1974 ( 403 network_ops PGNSP PGUID )); #define NETWORK_BTREE_FAM_OID 1974 DATA(insert OID = 1975 ( 405 network_ops PGNSP PGUID )); +DATA(insert OID = 3550 ( 783 network_ops PGNSP PGUID )); DATA(insert OID = 1976 ( 403 integer_ops PGNSP PGUID )); #define INTEGER_BTREE_FAM_OID 1976 DATA(insert OID = 1977 ( 405 integer_ops PGNSP PGUID )); @@ -96,6 +97,7 @@ DATA(insert OID = 1990 ( 405 oid_ops PGNSP PGUID )); DATA(insert OID = 1991 ( 403 oidvector_ops PGNSP PGUID )); DATA(insert OID = 1992 ( 405 oidvector_ops PGNSP PGUID )); DATA(insert OID = 2994 ( 403 record_ops PGNSP PGUID )); +DATA(insert OID = 3194 ( 403 record_image_ops PGNSP PGUID )); DATA(insert OID = 1994 ( 403 text_ops PGNSP PGUID )); #define TEXT_BTREE_FAM_OID 1994 DATA(insert OID = 1995 ( 405 text_ops PGNSP PGUID )); @@ -132,6 +134,8 @@ DATA(insert OID = 1029 ( 783 point_ops PGNSP PGUID )); DATA(insert OID = 2745 ( 2742 array_ops PGNSP PGUID )); DATA(insert OID = 2968 ( 403 uuid_ops PGNSP PGUID )); DATA(insert OID = 2969 ( 405 uuid_ops PGNSP PGUID )); +DATA(insert OID = 3253 ( 403 pg_lsn_ops PGNSP PGUID )); +DATA(insert OID = 3254 ( 405 pg_lsn_ops PGNSP PGUID )); DATA(insert OID = 3522 ( 403 enum_ops PGNSP PGUID )); DATA(insert OID = 3523 ( 405 enum_ops PGNSP PGUID )); DATA(insert OID = 3626 ( 403 tsvector_ops PGNSP PGUID )); @@ -142,9 +146,15 @@ DATA(insert OID = 3702 ( 783 tsquery_ops PGNSP PGUID )); DATA(insert OID = 3901 ( 403 range_ops PGNSP PGUID )); DATA(insert OID = 3903 ( 405 range_ops PGNSP PGUID )); DATA(insert OID = 3919 ( 783 range_ops PGNSP PGUID )); +DATA(insert OID = 3474 ( 4000 range_ops PGNSP PGUID )); DATA(insert OID = 4015 ( 4000 quad_point_ops PGNSP PGUID )); DATA(insert OID = 4016 ( 4000 kd_point_ops PGNSP PGUID )); DATA(insert OID = 4017 ( 4000 text_ops PGNSP PGUID )); #define TEXT_SPGIST_FAM_OID 4017 +DATA(insert OID = 4033 ( 403 jsonb_ops PGNSP PGUID )); +DATA(insert OID = 4034 ( 405 jsonb_ops PGNSP PGUID )); +DATA(insert OID = 4035 ( 783 jsonb_ops PGNSP PGUID )); +DATA(insert OID = 4036 ( 2742 jsonb_ops PGNSP PGUID )); +DATA(insert OID = 4037 ( 2742 jsonb_path_ops PGNSP PGUID )); #endif /* PG_OPFAMILY_H */ diff --git a/src/include/catalog/pg_pltemplate.h b/src/include/catalog/pg_pltemplate.h index d8927adcbe..c4eb4e3323 100644 --- a/src/include/catalog/pg_pltemplate.h +++ b/src/include/catalog/pg_pltemplate.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_pltemplate.h diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index d434303e62..2eed6e9d7e 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -9,7 +9,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_proc.h @@ -55,8 +55,8 @@ CATALOG(pg_proc,1255) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81) BKI_SCHEMA_MACRO bool proisstrict; /* strict with respect to NULLs? */ bool proretset; /* returns a set? */ char provolatile; /* see PROVOLATILE_ categories below */ - int2 pronargs; /* number of arguments */ - int2 pronargdefaults; /* number of arguments with defaults */ + int16 pronargs; /* number of arguments */ + int16 pronargdefaults; /* number of arguments with defaults */ Oid prorettype; /* OID of result type */ /* @@ -178,6 +178,10 @@ DATA(insert OID = 44 ( regprocin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 DESCR("I/O"); DATA(insert OID = 45 ( regprocout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "24" _null_ _null_ _null_ _null_ regprocout _null_ _null_ _null_ )); DESCR("I/O"); +DATA(insert OID = 3494 ( to_regproc PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 24 "2275" _null_ _null_ _null_ _null_ to_regproc _null_ _null_ _null_ )); +DESCR("convert proname to regproc"); +DATA(insert OID = 3479 ( to_regprocedure PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2202 "2275" _null_ _null_ _null_ _null_ to_regprocedure _null_ _null_ _null_ )); +DESCR("convert proname to regprocedure"); DATA(insert OID = 46 ( textin PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "2275" _null_ _null_ _null_ _null_ textin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 47 ( textout PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "25" _null_ _null_ _null_ _null_ textout _null_ _null_ _null_ )); @@ -845,6 +849,8 @@ DATA(insert OID = 2092 ( array_upper PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 DESCR("array upper dimension"); DATA(insert OID = 2176 ( array_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ array_length _null_ _null_ _null_ )); DESCR("array length"); +DATA(insert OID = 3179 ( cardinality PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2277" _null_ _null_ _null_ _null_ array_cardinality _null_ _null_ _null_ )); +DESCR("array cardinality"); DATA(insert OID = 378 ( array_append PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2277 2283" _null_ _null_ _null_ _null_ array_push _null_ _null_ _null_ )); DESCR("append element onto end of array"); DATA(insert OID = 379 ( array_prepend PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2283 2277" _null_ _null_ _null_ _null_ array_push _null_ _null_ _null_ )); @@ -872,9 +878,13 @@ DATA(insert OID = 1286 ( array_fill PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 22 DESCR("array constructor with value"); DATA(insert OID = 2331 ( unnest PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 2283 "2277" _null_ _null_ _null_ _null_ array_unnest _null_ _null_ _null_ )); DESCR("expand array to set of rows"); +DATA(insert OID = 3167 ( array_remove PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2277 2283" _null_ _null_ _null_ _null_ array_remove _null_ _null_ _null_ )); +DESCR("remove any occurrences of an element from an array"); +DATA(insert OID = 3168 ( array_replace PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2277 "2277 2283 2283" _null_ _null_ _null_ _null_ array_replace _null_ _null_ _null_ )); +DESCR("replace any occurrences of an element in an array"); DATA(insert OID = 2333 ( array_agg_transfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 2283" _null_ _null_ _null_ _null_ array_agg_transfn _null_ _null_ _null_ )); DESCR("aggregate transition function"); -DATA(insert OID = 2334 ( array_agg_finalfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2277 "2281" _null_ _null_ _null_ _null_ array_agg_finalfn _null_ _null_ _null_ )); +DATA(insert OID = 2334 ( array_agg_finalfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2277 "2281 2283" _null_ _null_ _null_ _null_ array_agg_finalfn _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 2335 ( array_agg PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 2277 "2283" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("concatenate aggregate input into an array"); @@ -1041,14 +1051,29 @@ DATA(insert OID = 955 ( lowrite PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 23 DESCR("large object write"); DATA(insert OID = 956 ( lo_lseek PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 23 "23 23 23" _null_ _null_ _null_ _null_ lo_lseek _null_ _null_ _null_ )); DESCR("large object seek"); +DATA(insert OID = 3170 ( lo_lseek64 PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 20 "23 20 23" _null_ _null_ _null_ _null_ lo_lseek64 _null_ _null_ _null_ )); +DESCR("large object seek (64 bit)"); DATA(insert OID = 957 ( lo_creat PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 26 "23" _null_ _null_ _null_ _null_ lo_creat _null_ _null_ _null_ )); DESCR("large object create"); DATA(insert OID = 715 ( lo_create PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 26 "26" _null_ _null_ _null_ _null_ lo_create _null_ _null_ _null_ )); DESCR("large object create"); DATA(insert OID = 958 ( lo_tell PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 23 "23" _null_ _null_ _null_ _null_ lo_tell _null_ _null_ _null_ )); DESCR("large object position"); +DATA(insert OID = 3171 ( lo_tell64 PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 20 "23" _null_ _null_ _null_ _null_ lo_tell64 _null_ _null_ _null_ )); +DESCR("large object position (64 bit)"); DATA(insert OID = 1004 ( lo_truncate PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 23 "23 23" _null_ _null_ _null_ _null_ lo_truncate _null_ _null_ _null_ )); DESCR("truncate large object"); +DATA(insert OID = 3172 ( lo_truncate64 PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 23 "23 20" _null_ _null_ _null_ _null_ lo_truncate64 _null_ _null_ _null_ )); +DESCR("truncate large object (64 bit)"); + +DATA(insert OID = 3457 ( lo_create PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 26 "26 17" _null_ _null_ _null_ _null_ lo_create_bytea _null_ _null_ _null_ )); +DESCR("create new large object with content"); +DATA(insert OID = 3458 ( lo_get PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 17 "26" _null_ _null_ _null_ _null_ lo_get _null_ _null_ _null_ )); +DESCR("read entire large object"); +DATA(insert OID = 3459 ( lo_get PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 17 "26 20 23" _null_ _null_ _null_ _null_ lo_get_fragment _null_ _null_ _null_ )); +DESCR("read large object from offset for length"); +DATA(insert OID = 3460 ( lo_put PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 2278 "26 20 17" _null_ _null_ _null_ _null_ lo_put _null_ _null_ _null_ )); +DESCR("write data at offset"); DATA(insert OID = 959 ( on_pl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "600 628" _null_ _null_ _null_ _null_ on_pl _null_ _null_ _null_ )); DATA(insert OID = 960 ( on_sl PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "601 628" _null_ _null_ _null_ _null_ on_sl _null_ _null_ _null_ )); @@ -1293,8 +1318,12 @@ DESCR("truncate interval to specified units"); DATA(insert OID = 1219 ( int8inc PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8inc _null_ _null_ _null_ )); DESCR("increment"); +DATA(insert OID = 3546 ( int8dec PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8dec _null_ _null_ _null_ )); +DESCR("decrement"); DATA(insert OID = 2804 ( int8inc_any PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 2276" _null_ _null_ _null_ _null_ int8inc_any _null_ _null_ _null_ )); DESCR("increment, ignores second argument"); +DATA(insert OID = 3547 ( int8dec_any PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 2276" _null_ _null_ _null_ _null_ int8dec_any _null_ _null_ _null_ )); +DESCR("decrement, ignores second argument"); DATA(insert OID = 1230 ( int8abs PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8abs _null_ _null_ _null_ )); DATA(insert OID = 1236 ( int8larger PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8larger _null_ _null_ _null_ )); @@ -1446,7 +1475,7 @@ DESCR("natural exponential (e^x)"); /* * This form of obj_description is now deprecated, since it will fail if - * OIDs are not unique across system catalogs. Use the other form instead. + * OIDs are not unique across system catalogs. Use the other form instead. */ DATA(insert OID = 1348 ( obj_description PGNSP PGUID 14 100 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ "select description from pg_catalog.pg_description where objoid = $1 and objsubid = 0" _null_ _null_ _null_ )); DESCR("deprecated, use two-argument form instead"); @@ -1751,7 +1780,7 @@ DATA(insert OID = 1576 ( setval PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 20 " DESCR("set sequence value"); DATA(insert OID = 1765 ( setval PGNSP PGUID 12 1 0 0 0 f f f f t f v 3 0 20 "2205 20 16" _null_ _null_ _null_ _null_ setval3_oid _null_ _null_ _null_ )); DESCR("set sequence value and is_called status"); -DATA(insert OID = 3078 ( pg_sequence_parameters PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2249 "26" "{23,20,20,20,20,16}" "{i,o,o,o,o,o}" "{sequence_oid,start_value,minimum_value,maximum_value,increment,cycle_option}" _null_ pg_sequence_parameters _null_ _null_ _null_)); +DATA(insert OID = 3078 ( pg_sequence_parameters PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2249 "26" "{26,20,20,20,20,16}" "{i,o,o,o,o,o}" "{sequence_oid,start_value,minimum_value,maximum_value,increment,cycle_option}" _null_ pg_sequence_parameters _null_ _null_ _null_)); DESCR("sequence parameters, for use by information schema"); DATA(insert OID = 1579 ( varbit_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1562 "2275 26 23" _null_ _null_ _null_ _null_ varbit_in _null_ _null_ _null_ )); @@ -1959,6 +1988,8 @@ DATA(insert OID = 2232 ( pg_get_function_identity_arguments PGNSP PGUID 12 1 DESCR("identity argument list of a function"); DATA(insert OID = 2165 ( pg_get_function_result PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_function_result _null_ _null_ _null_ )); DESCR("result type of a function"); +DATA(insert OID = 3808 ( pg_get_function_arg_default PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 25 "26 23" _null_ _null_ _null_ _null_ pg_get_function_arg_default _null_ _null_ _null_ )); +DESCR("function argument default"); DATA(insert OID = 1686 ( pg_get_keywords PGNSP PGUID 12 10 400 0 0 f f f f t t s 0 0 2249 "" "{25,18,25}" "{o,o,o}" "{word,catcode,catdesc}" _null_ pg_get_keywords _null_ _null_ _null_ )); DESCR("list of SQL keywords"); @@ -1971,6 +2002,11 @@ DESCR("type of the argument"); DATA(insert OID = 3162 ( pg_collation_for PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 25 "2276" _null_ _null_ _null_ _null_ pg_collation_for _null_ _null_ _null_ )); DESCR("collation of the argument; implementation of the COLLATION FOR expression"); +DATA(insert OID = 3842 ( pg_relation_is_updatable PGNSP PGUID 12 10 0 0 0 f f f f t f s 2 0 23 "2205 16" _null_ _null_ _null_ _null_ pg_relation_is_updatable _null_ _null_ _null_ )); +DESCR("is a relation insertable/updatable/deletable"); +DATA(insert OID = 3843 ( pg_column_is_updatable PGNSP PGUID 12 10 0 0 0 f f f f t f s 3 0 16 "2205 21 16" _null_ _null_ _null_ _null_ pg_column_is_updatable _null_ _null_ _null_ )); +DESCR("is a column updatable"); + /* Deferrable unique constraint trigger */ DATA(insert OID = 1250 ( unique_key_recheck PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ unique_key_recheck _null_ _null_ _null_ )); DESCR("deferred UNIQUE constraint check"); @@ -2095,6 +2131,7 @@ DATA(insert OID = 927 ( network_sub PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1 DATA(insert OID = 928 ( network_subeq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_subeq _null_ _null_ _null_ )); DATA(insert OID = 929 ( network_sup PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_sup _null_ _null_ _null_ )); DATA(insert OID = 930 ( network_supeq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_supeq _null_ _null_ _null_ )); +DATA(insert OID = 3551 ( network_overlap PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_ network_overlap _null_ _null_ _null_ )); /* inet/cidr functions */ DATA(insert OID = 598 ( abbrev PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "869" _null_ _null_ _null_ _null_ inet_abbrev _null_ _null_ _null_ )); @@ -2141,6 +2178,28 @@ DATA(insert OID = 2631 ( int8pl_inet PGNSP PGUID 14 1 0 0 0 f f f f t f i 2 0 DATA(insert OID = 2632 ( inetmi_int8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 869 "869 20" _null_ _null_ _null_ _null_ inetmi_int8 _null_ _null_ _null_ )); DATA(insert OID = 2633 ( inetmi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 20 "869 869" _null_ _null_ _null_ _null_ inetmi _null_ _null_ _null_ )); +/* GiST support for inet and cidr */ +DATA(insert OID = 3553 ( inet_gist_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 5 0 16 "2281 869 23 26 2281" _null_ _null_ _null_ _null_ inet_gist_consistent _null_ _null_ _null_ )); +DESCR("GiST support"); +DATA(insert OID = 3554 ( inet_gist_union PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ inet_gist_union _null_ _null_ _null_ )); +DESCR("GiST support"); +DATA(insert OID = 3555 ( inet_gist_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ inet_gist_compress _null_ _null_ _null_ )); +DESCR("GiST support"); +DATA(insert OID = 3556 ( inet_gist_decompress PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2281 "2281" _null_ _null_ _null_ _null_ inet_gist_decompress _null_ _null_ _null_ )); +DESCR("GiST support"); +DATA(insert OID = 3557 ( inet_gist_penalty PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ inet_gist_penalty _null_ _null_ _null_ )); +DESCR("GiST support"); +DATA(insert OID = 3558 ( inet_gist_picksplit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ inet_gist_picksplit _null_ _null_ _null_ )); +DESCR("GiST support"); +DATA(insert OID = 3559 ( inet_gist_same PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "869 869 2281" _null_ _null_ _null_ _null_ inet_gist_same _null_ _null_ _null_ )); +DESCR("GiST support"); + +/* Selectivity estimation for inet and cidr */ +DATA(insert OID = 3560 ( networksel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ networksel _null_ _null_ _null_ )); +DESCR("restriction selectivity for network operators"); +DATA(insert OID = 3561 ( networkjoinsel PGNSP PGUID 12 1 0 0 0 f f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ networkjoinsel _null_ _null_ _null_ )); +DESCR("join selectivity for network operators"); + DATA(insert OID = 1690 ( time_mi_time PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1083 1083" _null_ _null_ _null_ _null_ time_mi_time _null_ _null_ _null_ )); DATA(insert OID = 1691 ( boolle PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ boolle _null_ _null_ _null_ )); @@ -2371,27 +2430,37 @@ DATA(insert OID = 2513 ( float8_stddev_pop PGNSP PGUID 12 1 0 0 0 f f f f t f i DESCR("aggregate final function"); DATA(insert OID = 1832 ( float8_stddev_samp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "1022" _null_ _null_ _null_ _null_ float8_stddev_samp _null_ _null_ _null_ )); DESCR("aggregate final function"); -DATA(insert OID = 1833 ( numeric_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 1700" _null_ _null_ _null_ _null_ numeric_accum _null_ _null_ _null_ )); +DATA(insert OID = 1833 ( numeric_accum PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 1700" _null_ _null_ _null_ _null_ numeric_accum _null_ _null_ _null_ )); +DESCR("aggregate transition function"); +DATA(insert OID = 2858 ( numeric_avg_accum PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 1700" _null_ _null_ _null_ _null_ numeric_avg_accum _null_ _null_ _null_ )); +DESCR("aggregate transition function"); +DATA(insert OID = 3548 ( numeric_accum_inv PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 1700" _null_ _null_ _null_ _null_ numeric_accum_inv _null_ _null_ _null_ )); DESCR("aggregate transition function"); -DATA(insert OID = 2858 ( numeric_avg_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 1700" _null_ _null_ _null_ _null_ numeric_avg_accum _null_ _null_ _null_ )); +DATA(insert OID = 1834 ( int2_accum PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 21" _null_ _null_ _null_ _null_ int2_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); -DATA(insert OID = 1834 ( int2_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 21" _null_ _null_ _null_ _null_ int2_accum _null_ _null_ _null_ )); +DATA(insert OID = 1835 ( int4_accum PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 23" _null_ _null_ _null_ _null_ int4_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); -DATA(insert OID = 1835 ( int4_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 23" _null_ _null_ _null_ _null_ int4_accum _null_ _null_ _null_ )); +DATA(insert OID = 1836 ( int8_accum PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 20" _null_ _null_ _null_ _null_ int8_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); -DATA(insert OID = 1836 ( int8_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 20" _null_ _null_ _null_ _null_ int8_accum _null_ _null_ _null_ )); +DATA(insert OID = 2746 ( int8_avg_accum PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 20" _null_ _null_ _null_ _null_ int8_avg_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); -DATA(insert OID = 2746 ( int8_avg_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 20" _null_ _null_ _null_ _null_ int8_avg_accum _null_ _null_ _null_ )); +DATA(insert OID = 3567 ( int2_accum_inv PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 21" _null_ _null_ _null_ _null_ int2_accum_inv _null_ _null_ _null_ )); DESCR("aggregate transition function"); -DATA(insert OID = 1837 ( numeric_avg PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_avg _null_ _null_ _null_ )); +DATA(insert OID = 3568 ( int4_accum_inv PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 23" _null_ _null_ _null_ _null_ int4_accum_inv _null_ _null_ _null_ )); +DESCR("aggregate transition function"); +DATA(insert OID = 3569 ( int8_accum_inv PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 20" _null_ _null_ _null_ _null_ int8_accum_inv _null_ _null_ _null_ )); +DESCR("aggregate transition function"); +DATA(insert OID = 3178 ( numeric_sum PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ numeric_sum _null_ _null_ _null_ )); +DESCR("aggregate final function"); +DATA(insert OID = 1837 ( numeric_avg PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ numeric_avg _null_ _null_ _null_ )); DESCR("aggregate final function"); -DATA(insert OID = 2514 ( numeric_var_pop PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_var_pop _null_ _null_ _null_ )); +DATA(insert OID = 2514 ( numeric_var_pop PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ numeric_var_pop _null_ _null_ _null_ )); DESCR("aggregate final function"); -DATA(insert OID = 1838 ( numeric_var_samp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_var_samp _null_ _null_ _null_ )); +DATA(insert OID = 1838 ( numeric_var_samp PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ numeric_var_samp _null_ _null_ _null_ )); DESCR("aggregate final function"); -DATA(insert OID = 2596 ( numeric_stddev_pop PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_stddev_pop _null_ _null_ _null_ )); +DATA(insert OID = 2596 ( numeric_stddev_pop PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ numeric_stddev_pop _null_ _null_ _null_ )); DESCR("aggregate final function"); -DATA(insert OID = 1839 ( numeric_stddev_samp PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_stddev_samp _null_ _null_ _null_ )); +DATA(insert OID = 1839 ( numeric_stddev_samp PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 1700 "2281" _null_ _null_ _null_ _null_ numeric_stddev_samp _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 1840 ( int2_sum PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 20 "20 21" _null_ _null_ _null_ _null_ int2_sum _null_ _null_ _null_ )); DESCR("aggregate transition function"); @@ -2401,14 +2470,22 @@ DATA(insert OID = 1842 ( int8_sum PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 DESCR("aggregate transition function"); DATA(insert OID = 1843 ( interval_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1187 "1187 1186" _null_ _null_ _null_ _null_ interval_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); +DATA(insert OID = 3549 ( interval_accum_inv PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1187 "1187 1186" _null_ _null_ _null_ _null_ interval_accum_inv _null_ _null_ _null_ )); +DESCR("aggregate transition function"); DATA(insert OID = 1844 ( interval_avg PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1186 "1187" _null_ _null_ _null_ _null_ interval_avg _null_ _null_ _null_ )); DESCR("aggregate final function"); DATA(insert OID = 1962 ( int2_avg_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1016 "1016 21" _null_ _null_ _null_ _null_ int2_avg_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 1963 ( int4_avg_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1016 "1016 23" _null_ _null_ _null_ _null_ int4_avg_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); +DATA(insert OID = 3570 ( int2_avg_accum_inv PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1016 "1016 21" _null_ _null_ _null_ _null_ int2_avg_accum_inv _null_ _null_ _null_ )); +DESCR("aggregate transition function"); +DATA(insert OID = 3571 ( int4_avg_accum_inv PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1016 "1016 23" _null_ _null_ _null_ _null_ int4_avg_accum_inv _null_ _null_ _null_ )); +DESCR("aggregate transition function"); DATA(insert OID = 1964 ( int8_avg PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1016" _null_ _null_ _null_ _null_ int8_avg _null_ _null_ _null_ )); DESCR("aggregate final function"); +DATA(insert OID = 3572 ( int2int4_sum PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 20 "1016" _null_ _null_ _null_ _null_ int2int4_sum _null_ _null_ _null_ )); +DESCR("aggregate final function"); DATA(insert OID = 2805 ( int8inc_float8_float8 PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 20 "20 701 701" _null_ _null_ _null_ _null_ int8inc_float8_float8 _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 2806 ( float8_regr_accum PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1022 "1022 701 701" _null_ _null_ _null_ _null_ float8_regr_accum _null_ _null_ _null_ )); @@ -2439,19 +2516,19 @@ DESCR("aggregate final function"); DATA(insert OID = 3535 ( string_agg_transfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2281 "2281 25 25" _null_ _null_ _null_ _null_ string_agg_transfn _null_ _null_ _null_ )); DESCR("aggregate transition function"); #ifdef PGXC -DATA(insert OID = 2966 ( float8_collect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1022 "1022 1022" _null_ _null_ _null_ _null_ float8_collect _null_ _null_ _null_ )); +DATA(insert OID = 6000 ( float8_collect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1022 "1022 1022" _null_ _null_ _null_ _null_ float8_collect _null_ _null_ _null_ )); DESCR("aggregate collection function"); -DATA(insert OID = 2964 ( numeric_avg_collect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 1231" _null_ _null_ _null_ _null_ numeric_avg_collect _null_ _null_ _null_ )); +DATA(insert OID = 6001 ( numeric_avg_collect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 1231" _null_ _null_ _null_ _null_ numeric_avg_collect _null_ _null_ _null_ )); DESCR("aggregate collection function"); -DATA(insert OID = 2968 ( numeric_collect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 1231" _null_ _null_ _null_ _null_ numeric_collect _null_ _null_ _null_ )); +DATA(insert OID = 6002 ( numeric_collect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1231 "1231 1231" _null_ _null_ _null_ _null_ numeric_collect _null_ _null_ _null_ )); DESCR("aggregate collection function"); -DATA(insert OID = 2967 ( interval_collect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1187 "1187 1187" _null_ _null_ _null_ _null_ interval_collect _null_ _null_ _null_ )); +DATA(insert OID = 6003 ( interval_collect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1187 "1187 1187" _null_ _null_ _null_ _null_ interval_collect _null_ _null_ _null_ )); DESCR("aggregate transition function"); -DATA(insert OID = 2965 ( int8_avg_collect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1016 "1016 1016" _null_ _null_ _null_ _null_ int8_avg_collect _null_ _null_ _null_ )); +DATA(insert OID = 6004 ( int8_avg_collect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1016 "1016 1016" _null_ _null_ _null_ _null_ int8_avg_collect _null_ _null_ _null_ )); DESCR("AVG(int) collection function"); -DATA(insert OID = 2996 ( int8_sum_to_int8 PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8_sum_to_int8 _null_ _null_ _null_ )); +DATA(insert OID = 6005 ( int8_sum_to_int8 PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8_sum_to_int8 _null_ _null_ _null_ )); DESCR("SUM(int) collection function"); -DATA(insert OID = 2995 ( float8_regr_collect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1022 "1022 1022" _null_ _null_ _null_ _null_ float8_regr_collect _null_ _null_ _null_ )); +DATA(insert OID = 6006 ( float8_regr_collect PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1022 "1022 1022" _null_ _null_ _null_ _null_ float8_regr_collect _null_ _null_ _null_ )); DESCR("REGR_...(double, double) collection function"); #endif DATA(insert OID = 3536 ( string_agg_finalfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 25 "2281" _null_ _null_ _null_ _null_ string_agg_finalfn _null_ _null_ _null_ )); @@ -2599,6 +2676,8 @@ DATA(insert OID = 2878 ( pg_stat_get_live_tuples PGNSP PGUID 12 1 0 0 0 f f f f DESCR("statistics: number of live tuples"); DATA(insert OID = 2879 ( pg_stat_get_dead_tuples PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_dead_tuples _null_ _null_ _null_ )); DESCR("statistics: number of dead tuples"); +DATA(insert OID = 3177 ( pg_stat_get_mod_since_analyze PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_mod_since_analyze _null_ _null_ _null_ )); +DESCR("statistics: number of tuples changed since last analyze"); DATA(insert OID = 1934 ( pg_stat_get_blocks_fetched PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_blocks_fetched _null_ _null_ _null_ )); DESCR("statistics: number of blocks fetched"); DATA(insert OID = 1935 ( pg_stat_get_blocks_hit PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 20 "26" _null_ _null_ _null_ _null_ pg_stat_get_blocks_hit _null_ _null_ _null_ )); @@ -2621,9 +2700,9 @@ DATA(insert OID = 3057 ( pg_stat_get_autoanalyze_count PGNSP PGUID 12 1 0 0 0 f DESCR("statistics: number of auto analyzes for a table"); DATA(insert OID = 1936 ( pg_stat_get_backend_idset PGNSP PGUID 12 1 100 0 0 f f f f t t s 0 0 23 "" _null_ _null_ _null_ _null_ pg_stat_get_backend_idset _null_ _null_ _null_ )); DESCR("statistics: currently active backend IDs"); -DATA(insert OID = 2022 ( pg_stat_get_activity PGNSP PGUID 12 1 100 0 0 f f f f f t s 1 0 2249 "23" "{23,26,23,26,25,25,25,16,1184,1184,1184,1184,869,25,23}" "{i,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{pid,datid,pid,usesysid,application_name,state,query,waiting,xact_start,query_start,backend_start,state_change,client_addr,client_hostname,client_port}" _null_ pg_stat_get_activity _null_ _null_ _null_ )); +DATA(insert OID = 2022 ( pg_stat_get_activity PGNSP PGUID 12 1 100 0 0 f f f f f t s 1 0 2249 "23" "{23,26,23,26,25,25,25,16,1184,1184,1184,1184,869,25,23,28,28}" "{i,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}" "{pid,datid,pid,usesysid,application_name,state,query,waiting,xact_start,query_start,backend_start,state_change,client_addr,client_hostname,client_port,backend_xid,backend_xmin}" _null_ pg_stat_get_activity _null_ _null_ _null_ )); DESCR("statistics: information about currently active backends"); -DATA(insert OID = 3099 ( pg_stat_get_wal_senders PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{23,25,25,25,25,25,23,25}" "{o,o,o,o,o,o,o,o}" "{pid,state,sent_location,write_location,flush_location,replay_location,sync_priority,sync_state}" _null_ pg_stat_get_wal_senders _null_ _null_ _null_ )); +DATA(insert OID = 3099 ( pg_stat_get_wal_senders PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{23,25,3220,3220,3220,3220,23,25}" "{o,o,o,o,o,o,o,o}" "{pid,state,sent_location,write_location,flush_location,replay_location,sync_priority,sync_state}" _null_ pg_stat_get_wal_senders _null_ _null_ _null_ )); DESCR("statistics: information about currently active replication"); DATA(insert OID = 2026 ( pg_backend_pid PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 23 "" _null_ _null_ _null_ _null_ pg_backend_pid _null_ _null_ _null_ )); DESCR("statistics: current backend PID"); @@ -2691,6 +2770,8 @@ DATA(insert OID = 2844 ( pg_stat_get_db_blk_read_time PGNSP PGUID 12 1 0 0 0 f DESCR("statistics: block read time, in msec"); DATA(insert OID = 2845 ( pg_stat_get_db_blk_write_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 701 "26" _null_ _null_ _null_ _null_ pg_stat_get_db_blk_write_time _null_ _null_ _null_ )); DESCR("statistics: block write time, in msec"); +DATA(insert OID = 3195 ( pg_stat_get_archiver PGNSP PGUID 12 1 0 0 0 f f f f f f s 0 0 2249 "" "{20,25,1184,20,25,1184,1184}" "{o,o,o,o,o,o,o}" "{archived_count,last_archived_wal,last_archived_time,failed_count,last_failed_wal,last_failed_time,stats_reset}" _null_ pg_stat_get_archiver _null_ _null_ _null_ )); +DESCR("statistics: information about WAL archiver"); DATA(insert OID = 2769 ( pg_stat_get_bgwriter_timed_checkpoints PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_timed_checkpoints _null_ _null_ _null_ )); DESCR("statistics: number of timed checkpoints started by the bgwriter"); DATA(insert OID = 2770 ( pg_stat_get_bgwriter_requested_checkpoints PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 20 "" _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_requested_checkpoints _null_ _null_ _null_ )); @@ -2915,33 +2996,38 @@ DATA(insert OID = 1371 ( pg_lock_status PGNSP PGUID 12 1 1000 0 0 f f f f t t DESCR("view system lock information"); DATA(insert OID = 1065 ( pg_prepared_xact PGNSP PGUID 12 1 1000 0 0 f f f f t t v 0 0 2249 "" "{28,25,1184,26,26}" "{o,o,o,o,o}" "{transaction,gid,prepared,ownerid,dbid}" _null_ pg_prepared_xact _null_ _null_ _null_ )); DESCR("view two-phase transactions"); +DATA(insert OID = 3819 ( pg_get_multixact_members PGNSP PGUID 12 1 1000 0 0 f f f f t t v 1 0 2249 "28" "{28,28,25}" "{i,o,o}" "{multixid,xid,mode}" _null_ pg_get_multixact_members _null_ _null_ _null_ )); +DESCR("view members of a multixactid"); DATA(insert OID = 3537 ( pg_describe_object PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 25 "26 26 23" _null_ _null_ _null_ _null_ pg_describe_object _null_ _null_ _null_ )); DESCR("get identification of SQL object"); -DATA(insert OID = 2079 ( pg_table_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_table_is_visible _null_ _null_ _null_ )); +DATA(insert OID = 3839 ( pg_identify_object PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2249 "26 26 23" "{26,26,23,25,25,25,25}" "{i,i,i,o,o,o,o}" "{classid,objid,subobjid,type,schema,name,identity}" _null_ pg_identify_object _null_ _null_ _null_ )); +DESCR("get machine-parseable identification of SQL object"); + +DATA(insert OID = 2079 ( pg_table_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_table_is_visible _null_ _null_ _null_ )); DESCR("is table visible in search path?"); -DATA(insert OID = 2080 ( pg_type_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_type_is_visible _null_ _null_ _null_ )); +DATA(insert OID = 2080 ( pg_type_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_type_is_visible _null_ _null_ _null_ )); DESCR("is type visible in search path?"); -DATA(insert OID = 2081 ( pg_function_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_function_is_visible _null_ _null_ _null_ )); +DATA(insert OID = 2081 ( pg_function_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_function_is_visible _null_ _null_ _null_ )); DESCR("is function visible in search path?"); -DATA(insert OID = 2082 ( pg_operator_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_operator_is_visible _null_ _null_ _null_ )); +DATA(insert OID = 2082 ( pg_operator_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_operator_is_visible _null_ _null_ _null_ )); DESCR("is operator visible in search path?"); -DATA(insert OID = 2083 ( pg_opclass_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_opclass_is_visible _null_ _null_ _null_ )); +DATA(insert OID = 2083 ( pg_opclass_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_opclass_is_visible _null_ _null_ _null_ )); DESCR("is opclass visible in search path?"); -DATA(insert OID = 3829 ( pg_opfamily_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_opfamily_is_visible _null_ _null_ _null_ )); +DATA(insert OID = 3829 ( pg_opfamily_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_opfamily_is_visible _null_ _null_ _null_ )); DESCR("is opfamily visible in search path?"); -DATA(insert OID = 2093 ( pg_conversion_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_conversion_is_visible _null_ _null_ _null_ )); +DATA(insert OID = 2093 ( pg_conversion_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_conversion_is_visible _null_ _null_ _null_ )); DESCR("is conversion visible in search path?"); -DATA(insert OID = 3756 ( pg_ts_parser_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_ts_parser_is_visible _null_ _null_ _null_ )); +DATA(insert OID = 3756 ( pg_ts_parser_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_ts_parser_is_visible _null_ _null_ _null_ )); DESCR("is text search parser visible in search path?"); -DATA(insert OID = 3757 ( pg_ts_dict_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_ts_dict_is_visible _null_ _null_ _null_ )); +DATA(insert OID = 3757 ( pg_ts_dict_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_ts_dict_is_visible _null_ _null_ _null_ )); DESCR("is text search dictionary visible in search path?"); -DATA(insert OID = 3768 ( pg_ts_template_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_ts_template_is_visible _null_ _null_ _null_ )); +DATA(insert OID = 3768 ( pg_ts_template_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_ts_template_is_visible _null_ _null_ _null_ )); DESCR("is text search template visible in search path?"); -DATA(insert OID = 3758 ( pg_ts_config_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_ts_config_is_visible _null_ _null_ _null_ )); +DATA(insert OID = 3758 ( pg_ts_config_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_ts_config_is_visible _null_ _null_ _null_ )); DESCR("is text search configuration visible in search path?"); -DATA(insert OID = 3815 ( pg_collation_is_visible PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_collation_is_visible _null_ _null_ _null_ )); +DATA(insert OID = 3815 ( pg_collation_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_collation_is_visible _null_ _null_ _null_ )); DESCR("is collation visible in search path?"); DATA(insert OID = 2854 ( pg_my_temp_schema PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 26 "" _null_ _null_ _null_ _null_ pg_my_temp_schema _null_ _null_ _null_ )); @@ -2953,24 +3039,28 @@ DATA(insert OID = 2171 ( pg_cancel_backend PGNSP PGUID 12 1 0 0 0 f f f f t f v DESCR("cancel a server process' current query"); DATA(insert OID = 2096 ( pg_terminate_backend PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "23" _null_ _null_ _null_ _null_ pg_terminate_backend _null_ _null_ _null_ )); DESCR("terminate a server process"); -DATA(insert OID = 2172 ( pg_start_backup PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 25 "25 16" _null_ _null_ _null_ _null_ pg_start_backup _null_ _null_ _null_ )); +DATA(insert OID = 2172 ( pg_start_backup PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 3220 "25 16" _null_ _null_ _null_ _null_ pg_start_backup _null_ _null_ _null_ )); DESCR("prepare for taking an online backup"); -DATA(insert OID = 2173 ( pg_stop_backup PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_stop_backup _null_ _null_ _null_ )); +DATA(insert OID = 2173 ( pg_stop_backup PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ pg_stop_backup _null_ _null_ _null_ )); DESCR("finish taking an online backup"); -DATA(insert OID = 2848 ( pg_switch_xlog PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_switch_xlog _null_ _null_ _null_ )); +DATA(insert OID = 3813 ( pg_is_in_backup PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pg_is_in_backup _null_ _null_ _null_ )); +DESCR("true if server is in online backup"); +DATA(insert OID = 3814 ( pg_backup_start_time PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ pg_backup_start_time _null_ _null_ _null_ )); +DESCR("start time of an online backup"); +DATA(insert OID = 2848 ( pg_switch_xlog PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ pg_switch_xlog _null_ _null_ _null_ )); DESCR("switch to new xlog file"); -DATA(insert OID = 3098 ( pg_create_restore_point PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 25 "25" _null_ _null_ _null_ _null_ pg_create_restore_point _null_ _null_ _null_ )); +DATA(insert OID = 3098 ( pg_create_restore_point PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 3220 "25" _null_ _null_ _null_ _null_ pg_create_restore_point _null_ _null_ _null_ )); DESCR("create a named restore point"); -DATA(insert OID = 2849 ( pg_current_xlog_location PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_current_xlog_location _null_ _null_ _null_ )); +DATA(insert OID = 2849 ( pg_current_xlog_location PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ pg_current_xlog_location _null_ _null_ _null_ )); DESCR("current xlog write location"); -DATA(insert OID = 2852 ( pg_current_xlog_insert_location PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_current_xlog_insert_location _null_ _null_ _null_ )); +DATA(insert OID = 2852 ( pg_current_xlog_insert_location PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ pg_current_xlog_insert_location _null_ _null_ _null_ )); DESCR("current xlog insert location"); -DATA(insert OID = 2850 ( pg_xlogfile_name_offset PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2249 "25" "{25,25,23}" "{i,o,o}" "{wal_location,file_name,file_offset}" _null_ pg_xlogfile_name_offset _null_ _null_ _null_ )); +DATA(insert OID = 2850 ( pg_xlogfile_name_offset PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2249 "3220" "{3220,25,23}" "{i,o,o}" "{wal_location,file_name,file_offset}" _null_ pg_xlogfile_name_offset _null_ _null_ _null_ )); DESCR("xlog filename and byte offset, given an xlog location"); -DATA(insert OID = 2851 ( pg_xlogfile_name PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ pg_xlogfile_name _null_ _null_ _null_ )); +DATA(insert OID = 2851 ( pg_xlogfile_name PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "3220" _null_ _null_ _null_ _null_ pg_xlogfile_name _null_ _null_ _null_ )); DESCR("xlog filename, given an xlog location"); -DATA(insert OID = 3165 ( pg_xlog_location_diff PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "25 25" _null_ _null_ _null_ _null_ pg_xlog_location_diff _null_ _null_ _null_ )); +DATA(insert OID = 3165 ( pg_xlog_location_diff PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "3220 3220" _null_ _null_ _null_ _null_ pg_xlog_location_diff _null_ _null_ _null_ )); DESCR("difference in bytes, given two xlog locations"); DATA(insert OID = 3809 ( pg_export_snapshot PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_export_snapshot _null_ _null_ _null_ )); @@ -2979,9 +3069,9 @@ DESCR("export a snapshot"); DATA(insert OID = 3810 ( pg_is_in_recovery PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pg_is_in_recovery _null_ _null_ _null_ )); DESCR("true if server is in recovery"); -DATA(insert OID = 3820 ( pg_last_xlog_receive_location PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_last_xlog_receive_location _null_ _null_ _null_ )); +DATA(insert OID = 3820 ( pg_last_xlog_receive_location PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ pg_last_xlog_receive_location _null_ _null_ _null_ )); DESCR("current xlog flush location"); -DATA(insert OID = 3821 ( pg_last_xlog_replay_location PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_last_xlog_replay_location _null_ _null_ _null_ )); +DATA(insert OID = 3821 ( pg_last_xlog_replay_location PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ pg_last_xlog_replay_location _null_ _null_ _null_ )); DESCR("last xlog replay location"); DATA(insert OID = 3830 ( pg_last_xact_replay_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 1184 "" _null_ _null_ _null_ _null_ pg_last_xact_replay_timestamp _null_ _null_ _null_ )); DESCR("timestamp of last replay xact"); @@ -3012,6 +3102,10 @@ DATA(insert OID = 2625 ( pg_ls_dir PGNSP PGUID 12 1 1000 0 0 f f f f t t v 1 0 DESCR("list all files in a directory"); DATA(insert OID = 2626 ( pg_sleep PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 2278 "701" _null_ _null_ _null_ _null_ pg_sleep _null_ _null_ _null_ )); DESCR("sleep for the specified time in seconds"); +DATA(insert OID = 3935 ( pg_sleep_for PGNSP PGUID 14 1 0 0 0 f f f f t f v 1 0 2278 "1186" _null_ _null_ _null_ _null_ "select pg_catalog.pg_sleep(extract(epoch from pg_catalog.clock_timestamp() operator(pg_catalog.+) $1) operator(pg_catalog.-) extract(epoch from pg_catalog.clock_timestamp()))" _null_ _null_ _null_ )); +DESCR("sleep for the specified interval"); +DATA(insert OID = 3936 ( pg_sleep_until PGNSP PGUID 14 1 0 0 0 f f f f t f v 1 0 2278 "1184" _null_ _null_ _null_ _null_ "select pg_catalog.pg_sleep(extract(epoch from $1) operator(pg_catalog.-) extract(epoch from pg_catalog.clock_timestamp()))" _null_ _null_ _null_ )); +DESCR("sleep until the specified time"); DATA(insert OID = 2971 ( text PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "16" _null_ _null_ _null_ _null_ booltext _null_ _null_ _null_ )); DESCR("convert boolean to text"); @@ -3278,6 +3372,10 @@ DATA(insert OID = 2214 ( regoperin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2 DESCR("I/O"); DATA(insert OID = 2215 ( regoperout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2203" _null_ _null_ _null_ _null_ regoperout _null_ _null_ _null_ )); DESCR("I/O"); +DATA(insert OID = 3492 ( to_regoper PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2203 "2275" _null_ _null_ _null_ _null_ to_regoper _null_ _null_ _null_ )); +DESCR("convert operator name to regoper"); +DATA(insert OID = 3476 ( to_regoperator PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2204 "2275" _null_ _null_ _null_ _null_ to_regoperator _null_ _null_ _null_ )); +DESCR("convert operator name to regoperator"); DATA(insert OID = 2216 ( regoperatorin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2204 "2275" _null_ _null_ _null_ _null_ regoperatorin _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2217 ( regoperatorout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2204" _null_ _null_ _null_ _null_ regoperatorout _null_ _null_ _null_ )); @@ -3286,10 +3384,14 @@ DATA(insert OID = 2218 ( regclassin PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2 DESCR("I/O"); DATA(insert OID = 2219 ( regclassout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2205" _null_ _null_ _null_ _null_ regclassout _null_ _null_ _null_ )); DESCR("I/O"); +DATA(insert OID = 3495 ( to_regclass PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2205 "2275" _null_ _null_ _null_ _null_ to_regclass _null_ _null_ _null_ )); +DESCR("convert classname to regclass"); DATA(insert OID = 2220 ( regtypein PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2206 "2275" _null_ _null_ _null_ _null_ regtypein _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2221 ( regtypeout PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2275 "2206" _null_ _null_ _null_ _null_ regtypeout _null_ _null_ _null_ )); DESCR("I/O"); +DATA(insert OID = 3493 ( to_regtype PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2206 "2275" _null_ _null_ _null_ _null_ to_regtype _null_ _null_ _null_ )); +DESCR("convert type name to regtype"); DATA(insert OID = 1079 ( regclass PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 2205 "25" _null_ _null_ _null_ _null_ text_regclass _null_ _null_ _null_ )); DESCR("convert text to regclass"); @@ -3443,6 +3545,8 @@ DATA(insert OID = 2998 ( pg_indexes_size PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 DESCR("disk space usage for all indexes attached to the specified table"); DATA(insert OID = 2999 ( pg_relation_filenode PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 26 "2205" _null_ _null_ _null_ _null_ pg_relation_filenode _null_ _null_ _null_ )); DESCR("filenode identifier of relation"); +DATA(insert OID = 3454 ( pg_filenode_relation PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 2205 "26 26" _null_ _null_ _null_ _null_ pg_filenode_relation _null_ _null_ _null_ )); +DESCR("relation OID for filenode and tablespace"); DATA(insert OID = 3034 ( pg_relation_filepath PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 25 "2205" _null_ _null_ _null_ _null_ pg_relation_filepath _null_ _null_ _null_ )); DESCR("file path of relation"); @@ -3473,6 +3577,10 @@ DATA(insert OID = 2300 ( trigger_in PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2 DESCR("I/O"); DATA(insert OID = 2301 ( trigger_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2279" _null_ _null_ _null_ _null_ trigger_out _null_ _null_ _null_ )); DESCR("I/O"); +DATA(insert OID = 3594 ( event_trigger_in PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 3838 "2275" _null_ _null_ _null_ _null_ event_trigger_in _null_ _null_ _null_ )); +DESCR("I/O"); +DATA(insert OID = 3595 ( event_trigger_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3838" _null_ _null_ _null_ _null_ event_trigger_out _null_ _null_ _null_ )); +DESCR("I/O"); DATA(insert OID = 2302 ( language_handler_in PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 2280 "2275" _null_ _null_ _null_ _null_ language_handler_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2303 ( language_handler_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "2280" _null_ _null_ _null_ _null_ language_handler_out _null_ _null_ _null_ )); @@ -3832,6 +3940,14 @@ DATA(insert OID = 2515 ( booland_statefunc PGNSP PGUID 12 1 0 0 0 f f f f t DESCR("aggregate transition function"); DATA(insert OID = 2516 ( boolor_statefunc PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ boolor_statefunc _null_ _null_ _null_ )); DESCR("aggregate transition function"); +DATA(insert OID = 3496 ( bool_accum PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 16" _null_ _null_ _null_ _null_ bool_accum _null_ _null_ _null_ )); +DESCR("aggregate transition function"); +DATA(insert OID = 3497 ( bool_accum_inv PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 16" _null_ _null_ _null_ _null_ bool_accum_inv _null_ _null_ _null_ )); +DESCR("aggregate transition function"); +DATA(insert OID = 3498 ( bool_alltrue PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "2281" _null_ _null_ _null_ _null_ bool_alltrue _null_ _null_ _null_ )); +DESCR("aggregate final function"); +DATA(insert OID = 3499 ( bool_anytrue PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 16 "2281" _null_ _null_ _null_ _null_ bool_anytrue _null_ _null_ _null_ )); +DESCR("aggregate final function"); DATA(insert OID = 2517 ( bool_and PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 16 "16" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("boolean-and aggregate"); /* ANY, SOME? These names conflict with subquery operators. See doc. */ @@ -3959,6 +4075,8 @@ DATA(insert OID = 2774 ( ginqueryarrayextract PGNSP PGUID 12 1 0 0 0 f f f f t DESCR("GIN array support"); DATA(insert OID = 2744 ( ginarrayconsistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 8 0 16 "2281 21 2277 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ ginarrayconsistent _null_ _null_ _null_ )); DESCR("GIN array support"); +DATA(insert OID = 3920 ( ginarraytriconsistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 16 "2281 21 2277 23 2281 2281 2281" _null_ _null_ _null_ _null_ ginarraytriconsistent _null_ _null_ _null_ )); +DESCR("GIN array support"); DATA(insert OID = 3076 ( ginarrayextract PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2281 "2277 2281" _null_ _null_ _null_ _null_ ginarrayextract_2args _null_ _null_ _null_ )); DESCR("GIN array support (obsolete)"); @@ -4084,13 +4202,13 @@ DATA(insert OID = 3053 ( xml_is_well_formed_content PGNSP PGUID 12 1 0 0 0 f f DESCR("determine if a string is well formed XML content"); /* json */ -DATA(insert OID = 321 ( json_in PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 114 "2275" _null_ _null_ _null_ _null_ json_in _null_ _null_ _null_ )); +DATA(insert OID = 321 ( json_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 114 "2275" _null_ _null_ _null_ _null_ json_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 322 ( json_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "114" _null_ _null_ _null_ _null_ json_out _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 323 ( json_recv PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 114 "2281" _null_ _null_ _null_ _null_ json_recv _null_ _null_ _null_ )); +DATA(insert OID = 323 ( json_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 114 "2281" _null_ _null_ _null_ _null_ json_recv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 324 ( json_send PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "114" _null_ _null_ _null_ _null_ json_send _null_ _null_ _null_ )); +DATA(insert OID = 324 ( json_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "114" _null_ _null_ _null_ _null_ json_send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3153 ( array_to_json PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 114 "2277" _null_ _null_ _null_ _null_ array_to_json _null_ _null_ _null_ )); DESCR("map array to json"); @@ -4100,6 +4218,65 @@ DATA(insert OID = 3155 ( row_to_json PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 DESCR("map row to json"); DATA(insert OID = 3156 ( row_to_json PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 114 "2249 16" _null_ _null_ _null_ _null_ row_to_json_pretty _null_ _null_ _null_ )); DESCR("map row to json with optional pretty printing"); +DATA(insert OID = 3173 ( json_agg_transfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 2283" _null_ _null_ _null_ _null_ json_agg_transfn _null_ _null_ _null_ )); +DESCR("json aggregate transition function"); +DATA(insert OID = 3174 ( json_agg_finalfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 114 "2281" _null_ _null_ _null_ _null_ json_agg_finalfn _null_ _null_ _null_ )); +DESCR("json aggregate final function"); +DATA(insert OID = 3175 ( json_agg PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 114 "2283" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("aggregate input into json"); +DATA(insert OID = 3180 ( json_object_agg_transfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2281 "2281 2276 2276" _null_ _null_ _null_ _null_ json_object_agg_transfn _null_ _null_ _null_ )); +DESCR("json object aggregate transition function"); +DATA(insert OID = 3196 ( json_object_agg_finalfn PGNSP PGUID 12 1 0 0 0 f f f f f f i 1 0 114 "2281" _null_ _null_ _null_ _null_ json_object_agg_finalfn _null_ _null_ _null_ )); +DESCR("json object aggregate final function"); +DATA(insert OID = 3197 ( json_object_agg PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 114 "2276 2276" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("aggregate input into a json object"); +DATA(insert OID = 3198 ( json_build_array PGNSP PGUID 12 1 0 2276 0 f f f f f f i 1 0 114 "2276" "{2276}" "{v}" _null_ _null_ json_build_array _null_ _null_ _null_ )); +DESCR("build a json array from any inputs"); +DATA(insert OID = 3199 ( json_build_array PGNSP PGUID 12 1 0 0 0 f f f f f f i 0 0 114 "" _null_ _null_ _null_ _null_ json_build_array_noargs _null_ _null_ _null_ )); +DESCR("build an empty json array"); +DATA(insert OID = 3200 ( json_build_object PGNSP PGUID 12 1 0 2276 0 f f f f f f i 1 0 114 "2276" "{2276}" "{v}" _null_ _null_ json_build_object _null_ _null_ _null_ )); +DESCR("build a json object from pairwise key/value inputs"); +DATA(insert OID = 3201 ( json_build_object PGNSP PGUID 12 1 0 0 0 f f f f f f i 0 0 114 "" _null_ _null_ _null_ _null_ json_build_object_noargs _null_ _null_ _null_ )); +DESCR("build an empty json object"); +DATA(insert OID = 3202 ( json_object PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 114 "1009" _null_ _null_ _null_ _null_ json_object _null_ _null_ _null_ )); +DESCR("map text arrayof key value pais to json object"); +DATA(insert OID = 3203 ( json_object PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 114 "1009 1009" _null_ _null_ _null_ _null_ json_object_two_arg _null_ _null_ _null_ )); +DESCR("map text arrayof key value pais to json object"); +DATA(insert OID = 3176 ( to_json PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 114 "2283" _null_ _null_ _null_ _null_ to_json _null_ _null_ _null_ )); +DESCR("map input to json"); + +DATA(insert OID = 3947 ( json_object_field PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 114 "114 25" _null_ _null_ "{from_json, field_name}" _null_ json_object_field _null_ _null_ _null_ )); +DATA(insert OID = 3948 ( json_object_field_text PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "114 25" _null_ _null_ "{from_json, field_name}" _null_ json_object_field_text _null_ _null_ _null_ )); +DATA(insert OID = 3949 ( json_array_element PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 114 "114 23" _null_ _null_ "{from_json, element_index}" _null_ json_array_element _null_ _null_ _null_ )); +DATA(insert OID = 3950 ( json_array_element_text PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "114 23" _null_ _null_ "{from_json, element_index}" _null_ json_array_element_text _null_ _null_ _null_ )); +DATA(insert OID = 3951 ( json_extract_path PGNSP PGUID 12 1 0 25 0 f f f f t f i 2 0 114 "114 1009" "{114,1009}" "{i,v}" "{from_json,path_elems}" _null_ json_extract_path _null_ _null_ _null_ )); +DESCR("get value from json with path elements"); +DATA(insert OID = 3952 ( json_extract_path_op PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 114 "114 1009" _null_ _null_ "{from_json,path_elems}" _null_ json_extract_path _null_ _null_ _null_ )); +DATA(insert OID = 3953 ( json_extract_path_text PGNSP PGUID 12 1 0 25 0 f f f f t f i 2 0 25 "114 1009" "{114,1009}" "{i,v}" "{from_json,path_elems}" _null_ json_extract_path_text _null_ _null_ _null_ )); +DESCR("get value from json as text with path elements"); +DATA(insert OID = 3954 ( json_extract_path_text_op PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "114 1009" _null_ _null_ "{from_json,path_elems}" _null_ json_extract_path_text _null_ _null_ _null_ )); +DATA(insert OID = 3955 ( json_array_elements PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 114 "114" "{114,114}" "{i,o}" "{from_json,value}" _null_ json_array_elements _null_ _null_ _null_ )); +DESCR("key value pairs of a json object"); +DATA(insert OID = 3969 ( json_array_elements_text PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 25 "114" "{114,25}" "{i,o}" "{from_json,value}" _null_ json_array_elements_text _null_ _null_ _null_ )); +DESCR("elements of json array"); +DATA(insert OID = 3956 ( json_array_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "114" _null_ _null_ _null_ _null_ json_array_length _null_ _null_ _null_ )); +DESCR("length of json array"); +DATA(insert OID = 3957 ( json_object_keys PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 25 "114" _null_ _null_ _null_ _null_ json_object_keys _null_ _null_ _null_ )); +DESCR("get json object keys"); +DATA(insert OID = 3958 ( json_each PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 2249 "114" "{114,25,114}" "{i,o,o}" "{from_json,key,value}" _null_ json_each _null_ _null_ _null_ )); +DESCR("key value pairs of a json object"); +DATA(insert OID = 3959 ( json_each_text PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 2249 "114" "{114,25,25}" "{i,o,o}" "{from_json,key,value}" _null_ json_each_text _null_ _null_ _null_ )); +DESCR("key value pairs of a json object"); +DATA(insert OID = 3960 ( json_populate_record PGNSP PGUID 12 1 0 0 0 f f f f f f s 3 0 2283 "2283 114 16" _null_ _null_ _null_ _null_ json_populate_record _null_ _null_ _null_ )); +DESCR("get record fields from a json object"); +DATA(insert OID = 3961 ( json_populate_recordset PGNSP PGUID 12 1 100 0 0 f f f f f t s 3 0 2283 "2283 114 16" _null_ _null_ _null_ _null_ json_populate_recordset _null_ _null_ _null_ )); +DESCR("get set of records with fields from a json array of objects"); +DATA(insert OID = 3204 ( json_to_record PGNSP PGUID 12 1 0 0 0 f f f f f f s 2 0 2249 "114 16" _null_ _null_ _null_ _null_ json_to_record _null_ _null_ _null_ )); +DESCR("get record fields from a json object"); +DATA(insert OID = 3205 ( json_to_recordset PGNSP PGUID 12 1 100 0 0 f f f f f t s 2 0 2249 "114 16" _null_ _null_ _null_ _null_ json_to_recordset _null_ _null_ _null_ )); +DESCR("get set of records with fields from a json array of objects"); +DATA(insert OID = 3968 ( json_typeof PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "114" _null_ _null_ _null_ _null_ json_typeof _null_ _null_ _null_ )); +DESCR("get the type of a json value"); /* uuid */ DATA(insert OID = 2952 ( uuid_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2950 "2275" _null_ _null_ _null_ _null_ uuid_in _null_ _null_ _null_ )); @@ -4121,6 +4298,27 @@ DESCR("I/O"); DATA(insert OID = 2963 ( uuid_hash PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "2950" _null_ _null_ _null_ _null_ uuid_hash _null_ _null_ _null_ )); DESCR("hash"); +/* pg_lsn */ +DATA(insert OID = 3229 ( pg_lsn_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3220 "2275" _null_ _null_ _null_ _null_ pg_lsn_in _null_ _null_ _null_ )); +DESCR("I/O"); +DATA(insert OID = 3230 ( pg_lsn_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3220" _null_ _null_ _null_ _null_ pg_lsn_out _null_ _null_ _null_ )); +DESCR("I/O"); +DATA(insert OID = 3231 ( pg_lsn_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3220 3220" _null_ _null_ _null_ _null_ pg_lsn_lt _null_ _null_ _null_ )); +DATA(insert OID = 3232 ( pg_lsn_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3220 3220" _null_ _null_ _null_ _null_ pg_lsn_le _null_ _null_ _null_ )); +DATA(insert OID = 3233 ( pg_lsn_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3220 3220" _null_ _null_ _null_ _null_ pg_lsn_eq _null_ _null_ _null_ )); +DATA(insert OID = 3234 ( pg_lsn_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3220 3220" _null_ _null_ _null_ _null_ pg_lsn_ge _null_ _null_ _null_ )); +DATA(insert OID = 3235 ( pg_lsn_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3220 3220" _null_ _null_ _null_ _null_ pg_lsn_gt _null_ _null_ _null_ )); +DATA(insert OID = 3236 ( pg_lsn_ne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3220 3220" _null_ _null_ _null_ _null_ pg_lsn_ne _null_ _null_ _null_ )); +DATA(insert OID = 3237 ( pg_lsn_mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "3220 3220" _null_ _null_ _null_ _null_ pg_lsn_mi _null_ _null_ _null_ )); +DATA(insert OID = 3238 ( pg_lsn_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3220 "2281" _null_ _null_ _null_ _null_ pg_lsn_recv _null_ _null_ _null_ )); +DESCR("I/O"); +DATA(insert OID = 3239 ( pg_lsn_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3220" _null_ _null_ _null_ _null_ pg_lsn_send _null_ _null_ _null_ )); +DESCR("I/O"); +DATA(insert OID = 3251 ( pg_lsn_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "3220 3220" _null_ _null_ _null_ _null_ pg_lsn_cmp _null_ _null_ _null_ )); +DESCR("less-equal-greater"); +DATA(insert OID = 3252 ( pg_lsn_hash PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3220" _null_ _null_ _null_ _null_ pg_lsn_hash _null_ _null_ _null_ )); +DESCR("hash"); + /* enum related procs */ DATA(insert OID = 3504 ( anyenum_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3500 "2275" _null_ _null_ _null_ _null_ anyenum_in _null_ _null_ _null_ )); DESCR("I/O"); @@ -4156,7 +4354,7 @@ DATA(insert OID = 3530 ( enum_range PGNSP PGUID 12 1 0 0 0 f f f f f f s 2 0 22 DESCR("range between the two given enum values, as an ordered array"); DATA(insert OID = 3531 ( enum_range PGNSP PGUID 12 1 0 0 0 f f f f f f s 1 0 2277 "3500" _null_ _null_ _null_ _null_ enum_range_all _null_ _null_ _null_ )); DESCR("range of the given enum type, as an ordered array"); -DATA(insert OID = 3532 ( enum_recv PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 3500 "2275 26" _null_ _null_ _null_ _null_ enum_recv _null_ _null_ _null_ )); +DATA(insert OID = 3532 ( enum_recv PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 3500 "2281 26" _null_ _null_ _null_ _null_ enum_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 3533 ( enum_send PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 17 "3500" _null_ _null_ _null_ _null_ enum_send _null_ _null_ _null_ )); DESCR("I/O"); @@ -4226,6 +4424,8 @@ DATA(insert OID = 3657 ( gin_extract_tsquery PGNSP PGUID 12 1 0 0 0 f f f f t f DESCR("GIN tsvector support"); DATA(insert OID = 3658 ( gin_tsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 8 0 16 "2281 21 3615 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gin_tsquery_consistent _null_ _null_ _null_ )); DESCR("GIN tsvector support"); +DATA(insert OID = 3921 ( gin_tsquery_triconsistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 16 "2281 21 3615 23 2281 2281 2281" _null_ _null_ _null_ _null_ gin_tsquery_triconsistent _null_ _null_ _null_ )); +DESCR("GIN tsvector support"); DATA(insert OID = 3724 ( gin_cmp_tslexeme PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ gin_cmp_tslexeme _null_ _null_ _null_ )); DESCR("GIN tsvector support"); DATA(insert OID = 2700 ( gin_cmp_prefix PGNSP PGUID 12 1 0 0 0 f f f f t f i 4 0 23 "25 25 21 2281" _null_ _null_ _null_ _null_ gin_cmp_prefix _null_ _null_ _null_ )); @@ -4398,6 +4598,87 @@ DESCR("I/O"); DATA(insert OID = 3774 ( regdictionarysend PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3769" _null_ _null_ _null_ _null_ regdictionarysend _null_ _null_ _null_ )); DESCR("I/O"); +/* jsonb */ +DATA(insert OID = 3806 ( jsonb_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3802 "2275" _null_ _null_ _null_ _null_ jsonb_in _null_ _null_ _null_ )); +DESCR("I/O"); +DATA(insert OID = 3805 ( jsonb_recv PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3802 "2281" _null_ _null_ _null_ _null_ jsonb_recv _null_ _null_ _null_ )); +DESCR("I/O"); +DATA(insert OID = 3804 ( jsonb_out PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2275 "3802" _null_ _null_ _null_ _null_ jsonb_out _null_ _null_ _null_ )); +DESCR("I/O"); +DATA(insert OID = 3803 ( jsonb_send PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 17 "3802" _null_ _null_ _null_ _null_ jsonb_send _null_ _null_ _null_ )); +DESCR("I/O"); + +DATA(insert OID = 3478 ( jsonb_object_field PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3802 "3802 25" _null_ _null_ "{from_json, field_name}" _null_ jsonb_object_field _null_ _null_ _null_ )); +DATA(insert OID = 3214 ( jsonb_object_field_text PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "3802 25" _null_ _null_ "{from_json, field_name}" _null_ jsonb_object_field_text _null_ _null_ _null_ )); +DATA(insert OID = 3215 ( jsonb_array_element PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3802 "3802 23" _null_ _null_ "{from_json, element_index}" _null_ jsonb_array_element _null_ _null_ _null_ )); +DATA(insert OID = 3216 ( jsonb_array_element_text PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "3802 23" _null_ _null_ "{from_json, element_index}" _null_ jsonb_array_element_text _null_ _null_ _null_ )); +DATA(insert OID = 3217 ( jsonb_extract_path PGNSP PGUID 12 1 0 25 0 f f f f t f i 2 0 3802 "3802 1009" "{3802,1009}" "{i,v}" "{from_json,path_elems}" _null_ jsonb_extract_path _null_ _null_ _null_ )); +DESCR("get value from jsonb with path elements"); +DATA(insert OID = 3939 ( jsonb_extract_path_op PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3802 "3802 1009" _null_ _null_ "{from_json,path_elems}" _null_ jsonb_extract_path _null_ _null_ _null_ )); +DATA(insert OID = 3940 ( jsonb_extract_path_text PGNSP PGUID 12 1 0 25 0 f f f f t f i 2 0 25 "3802 1009" "{3802,1009}" "{i,v}" "{from_json,path_elems}" _null_ jsonb_extract_path_text _null_ _null_ _null_ )); +DESCR("get value from jsonb as text with path elements"); +DATA(insert OID = 3218 ( jsonb_extract_path_text_op PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 25 "3802 1009" _null_ _null_ "{from_json,path_elems}" _null_ jsonb_extract_path_text _null_ _null_ _null_ )); +DATA(insert OID = 3219 ( jsonb_array_elements PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 3802 "3802" "{3802,3802}" "{i,o}" "{from_json,value}" _null_ jsonb_array_elements _null_ _null_ _null_ )); +DESCR("elements of a jsonb array"); +DATA(insert OID = 3465 ( jsonb_array_elements_text PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 25 "3802" "{3802,25}" "{i,o}" "{from_json,value}" _null_ jsonb_array_elements_text _null_ _null_ _null_ )); +DESCR("elements of jsonb array"); +DATA(insert OID = 3207 ( jsonb_array_length PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3802" _null_ _null_ _null_ _null_ jsonb_array_length _null_ _null_ _null_ )); +DESCR("length of jsonb array"); +DATA(insert OID = 3931 ( jsonb_object_keys PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 25 "3802" _null_ _null_ _null_ _null_ jsonb_object_keys _null_ _null_ _null_ )); +DESCR("get jsonb object keys"); +DATA(insert OID = 3208 ( jsonb_each PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 2249 "3802" "{3802,25,3802}" "{i,o,o}" "{from_json,key,value}" _null_ jsonb_each _null_ _null_ _null_ )); +DESCR("key value pairs of a jsonb object"); +DATA(insert OID = 3932 ( jsonb_each_text PGNSP PGUID 12 1 100 0 0 f f f f t t i 1 0 2249 "3802" "{3802,25,25}" "{i,o,o}" "{from_json,key,value}" _null_ jsonb_each_text _null_ _null_ _null_ )); +DESCR("key value pairs of a jsonb object"); +DATA(insert OID = 3209 ( jsonb_populate_record PGNSP PGUID 12 1 0 0 0 f f f f f f s 3 0 2283 "2283 3802 16" _null_ _null_ _null_ _null_ jsonb_populate_record _null_ _null_ _null_ )); +DESCR("get record fields from a jsonb object"); +DATA(insert OID = 3475 ( jsonb_populate_recordset PGNSP PGUID 12 1 100 0 0 f f f f f t s 3 0 2283 "2283 3802 16" _null_ _null_ _null_ _null_ jsonb_populate_recordset _null_ _null_ _null_ )); +DESCR("get set of records with fields from a jsonb array of objects"); +DATA(insert OID = 3490 ( jsonb_to_record PGNSP PGUID 12 1 0 0 0 f f f f f f s 2 0 2249 "3802 16" _null_ _null_ _null_ _null_ jsonb_to_record _null_ _null_ _null_ )); +DESCR("get record fields from a json object"); +DATA(insert OID = 3491 ( jsonb_to_recordset PGNSP PGUID 12 1 100 0 0 f f f f f t s 2 0 2249 "3802 16" _null_ _null_ _null_ _null_ jsonb_to_recordset _null_ _null_ _null_ )); +DESCR("get set of records with fields from a json array of objects"); +DATA(insert OID = 3210 ( jsonb_typeof PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "3802" _null_ _null_ _null_ _null_ jsonb_typeof _null_ _null_ _null_ )); +DESCR("get the type of a jsonb value"); +DATA(insert OID = 4038 ( jsonb_ne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ jsonb_ne _null_ _null_ _null_ )); +DATA(insert OID = 4039 ( jsonb_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ jsonb_lt _null_ _null_ _null_ )); +DATA(insert OID = 4040 ( jsonb_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ jsonb_gt _null_ _null_ _null_ )); +DATA(insert OID = 4041 ( jsonb_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ jsonb_le _null_ _null_ _null_ )); +DATA(insert OID = 4042 ( jsonb_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ jsonb_ge _null_ _null_ _null_ )); +DATA(insert OID = 4043 ( jsonb_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ jsonb_eq _null_ _null_ _null_ )); +DATA(insert OID = 4044 ( jsonb_cmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "3802 3802" _null_ _null_ _null_ _null_ jsonb_cmp _null_ _null_ _null_ )); +DESCR("less-equal-greater"); +DATA(insert OID = 4045 ( jsonb_hash PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 23 "3802" _null_ _null_ _null_ _null_ jsonb_hash _null_ _null_ _null_ )); +DESCR("hash"); +DATA(insert OID = 4046 ( jsonb_contains PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ jsonb_contains _null_ _null_ _null_ )); +DESCR("implementation of @> operator"); +DATA(insert OID = 4047 ( jsonb_exists PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 25" _null_ _null_ _null_ _null_ jsonb_exists _null_ _null_ _null_ )); +DESCR("implementation of ? operator"); +DATA(insert OID = 4048 ( jsonb_exists_any PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 1009" _null_ _null_ _null_ _null_ jsonb_exists_any _null_ _null_ _null_ )); +DESCR("implementation of ?| operator"); +DATA(insert OID = 4049 ( jsonb_exists_all PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 1009" _null_ _null_ _null_ _null_ jsonb_exists_all _null_ _null_ _null_ )); +DESCR("implementation of ?& operator"); +DATA(insert OID = 4050 ( jsonb_contained PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3802 3802" _null_ _null_ _null_ _null_ jsonb_contained _null_ _null_ _null_ )); +DESCR("implementation of <@ operator"); +DATA(insert OID = 3480 ( gin_compare_jsonb PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ gin_compare_jsonb _null_ _null_ _null_ )); +DESCR("GIN support"); +DATA(insert OID = 3482 ( gin_extract_jsonb PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ gin_extract_jsonb _null_ _null_ _null_ )); +DESCR("GIN support"); +DATA(insert OID = 3483 ( gin_extract_jsonb_query PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 2281 "2277 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gin_extract_jsonb_query _null_ _null_ _null_ )); +DESCR("GIN support"); +DATA(insert OID = 3484 ( gin_consistent_jsonb PGNSP PGUID 12 1 0 0 0 f f f f t f i 8 0 16 "2281 21 2277 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gin_consistent_jsonb _null_ _null_ _null_ )); +DESCR("GIN support"); +DATA(insert OID = 3488 ( gin_triconsistent_jsonb PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 16 "2281 21 2277 23 2281 2281 2281" _null_ _null_ _null_ _null_ gin_triconsistent_jsonb _null_ _null_ _null_ )); +DESCR("GIN support"); +DATA(insert OID = 3485 ( gin_extract_jsonb_path PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ gin_extract_jsonb_path _null_ _null_ _null_ )); +DESCR("GIN support"); +DATA(insert OID = 3486 ( gin_extract_jsonb_query_path PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 2281 "2277 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gin_extract_jsonb_query_path _null_ _null_ _null_ )); +DESCR("GIN support"); +DATA(insert OID = 3487 ( gin_consistent_jsonb_path PGNSP PGUID 12 1 0 0 0 f f f f t f i 8 0 16 "2281 21 2277 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gin_consistent_jsonb_path _null_ _null_ _null_ )); +DESCR("GIN support"); +DATA(insert OID = 3489 ( gin_triconsistent_jsonb_path PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 16 "2281 21 2277 23 2281 2281 2281" _null_ _null_ _null_ _null_ gin_triconsistent_jsonb_path _null_ _null_ _null_ )); +DESCR("GIN support"); + /* txid */ DATA(insert OID = 2939 ( txid_snapshot_in PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2970 "2275" _null_ _null_ _null_ _null_ txid_snapshot_in _null_ _null_ _null_ )); DESCR("I/O"); @@ -4420,7 +4701,7 @@ DESCR("get set of in-progress txids in snapshot"); DATA(insert OID = 2948 ( txid_visible_in_snapshot PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "20 2970" _null_ _null_ _null_ _null_ txid_visible_in_snapshot _null_ _null_ _null_ )); DESCR("is txid visible in snapshot?"); -/* record comparison */ +/* record comparison using normal comparison rules */ DATA(insert OID = 2981 ( record_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_eq _null_ _null_ _null_ )); DATA(insert OID = 2982 ( record_ne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_ne _null_ _null_ _null_ )); DATA(insert OID = 2983 ( record_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_lt _null_ _null_ _null_ )); @@ -4430,6 +4711,16 @@ DATA(insert OID = 2986 ( record_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 DATA(insert OID = 2987 ( btrecordcmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2249 2249" _null_ _null_ _null_ _null_ btrecordcmp _null_ _null_ _null_ )); DESCR("less-equal-greater"); +/* record comparison using raw byte images */ +DATA(insert OID = 3181 ( record_image_eq PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_image_eq _null_ _null_ _null_ )); +DATA(insert OID = 3182 ( record_image_ne PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_image_ne _null_ _null_ _null_ )); +DATA(insert OID = 3183 ( record_image_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_image_lt _null_ _null_ _null_ )); +DATA(insert OID = 3184 ( record_image_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_image_gt _null_ _null_ _null_ )); +DATA(insert OID = 3185 ( record_image_le PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_image_le _null_ _null_ _null_ )); +DATA(insert OID = 3186 ( record_image_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2249 2249" _null_ _null_ _null_ _null_ record_image_ge _null_ _null_ _null_ )); +DATA(insert OID = 3187 ( btrecordimagecmp PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "2249 2249" _null_ _null_ _null_ _null_ btrecordimagecmp _null_ _null_ _null_ )); +DESCR("less-equal-greater based on byte images"); + /* Extensions */ DATA(insert OID = 3082 ( pg_available_extensions PGNSP PGUID 12 10 100 0 0 f f f f t t s 0 0 2249 "" "{19,25,25}" "{o,o,o}" "{name,default_version,comment}" _null_ pg_available_extensions _null_ _null_ _null_ )); DESCR("list available extensions"); @@ -4553,6 +4844,8 @@ DATA(insert OID = 3902 ( hash_range PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 DESCR("hash a range"); DATA(insert OID = 3916 ( range_typanalyze PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 16 "2281" _null_ _null_ _null_ _null_ range_typanalyze _null_ _null_ _null_ )); DESCR("range typanalyze"); +DATA(insert OID = 3169 ( rangesel PGNSP PGUID 12 1 0 0 0 f f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ rangesel _null_ _null_ _null_ )); +DESCR("restriction selectivity for range operators"); DATA(insert OID = 3914 ( int4range_canonical PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3904 "3904" _null_ _null_ _null_ _null_ int4range_canonical _null_ _null_ _null_ )); DESCR("convert an int4 range to canonical form"); @@ -4598,6 +4891,20 @@ DESCR("int8range constructor"); DATA(insert OID = 3946 ( int8range PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 3926 "20 20 25" _null_ _null_ _null_ _null_ range_constructor3 _null_ _null_ _null_ )); DESCR("int8range constructor"); +/* date, time, timestamp constructors */ +DATA(insert OID = 3846 ( make_date PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1082 "23 23 23" _null_ _null_ "{year,month,day}" _null_ make_date _null_ _null_ _null_ )); +DESCR("construct date"); +DATA(insert OID = 3847 ( make_time PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 1083 "23 23 701" _null_ _null_ "{hour,min,sec}" _null_ make_time _null_ _null_ _null_ )); +DESCR("construct time"); +DATA(insert OID = 3461 ( make_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f i 6 0 1114 "23 23 23 23 23 701" _null_ _null_ "{year,month,mday,hour,min,sec}" _null_ make_timestamp _null_ _null_ _null_ )); +DESCR("construct timestamp"); +DATA(insert OID = 3462 ( make_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 6 0 1184 "23 23 23 23 23 701" _null_ _null_ "{year,month,mday,hour,min,sec}" _null_ make_timestamptz _null_ _null_ _null_ )); +DESCR("construct timestamp with time zone"); +DATA(insert OID = 3463 ( make_timestamptz PGNSP PGUID 12 1 0 0 0 f f f f t f s 7 0 1184 "23 23 23 23 23 701 25" _null_ _null_ "{year,month,mday,hour,min,sec,timezone}" _null_ make_timestamptz_at_timezone _null_ _null_ _null_ )); +DESCR("construct timestamp with time zone"); +DATA(insert OID = 3464 ( make_interval PGNSP PGUID 12 1 0 0 0 f f f f t f i 7 0 1186 "23 23 23 23 23 23 701" _null_ _null_ "{years,months,weeks,days,hours,mins,secs}" _null_ make_interval _null_ _null_ _null_ )); +DESCR("construct interval"); + /* spgist support functions */ DATA(insert OID = 4001 ( spggettuple PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ spggettuple _null_ _null_ _null_ )); DESCR("spgist(internal)"); @@ -4652,29 +4959,116 @@ DATA(insert OID = 4026 ( spg_kd_inner_consistent PGNSP PGUID 12 1 0 0 0 f f f f DESCR("SP-GiST support for k-d tree over point"); DATA(insert OID = 4027 ( spg_text_config PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_text_config _null_ _null_ _null_ )); -DESCR("SP-GiST support for suffix tree over text"); +DESCR("SP-GiST support for radix tree over text"); DATA(insert OID = 4028 ( spg_text_choose PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_text_choose _null_ _null_ _null_ )); -DESCR("SP-GiST support for suffix tree over text"); +DESCR("SP-GiST support for radix tree over text"); DATA(insert OID = 4029 ( spg_text_picksplit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_text_picksplit _null_ _null_ _null_ )); -DESCR("SP-GiST support for suffix tree over text"); +DESCR("SP-GiST support for radix tree over text"); DATA(insert OID = 4030 ( spg_text_inner_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_text_inner_consistent _null_ _null_ _null_ )); -DESCR("SP-GiST support for suffix tree over text"); +DESCR("SP-GiST support for radix tree over text"); DATA(insert OID = 4031 ( spg_text_leaf_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ spg_text_leaf_consistent _null_ _null_ _null_ )); -DESCR("SP-GiST support for suffix tree over text"); +DESCR("SP-GiST support for radix tree over text"); + +DATA(insert OID = 3469 ( spg_range_quad_config PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_range_quad_config _null_ _null_ _null_ )); +DESCR("SP-GiST support for quad tree over range"); +DATA(insert OID = 3470 ( spg_range_quad_choose PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_range_quad_choose _null_ _null_ _null_ )); +DESCR("SP-GiST support for quad tree over range"); +DATA(insert OID = 3471 ( spg_range_quad_picksplit PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_range_quad_picksplit _null_ _null_ _null_ )); +DESCR("SP-GiST support for quad tree over range"); +DATA(insert OID = 3472 ( spg_range_quad_inner_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ spg_range_quad_inner_consistent _null_ _null_ _null_ )); +DESCR("SP-GiST support for quad tree over range"); +DATA(insert OID = 3473 ( spg_range_quad_leaf_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ spg_range_quad_leaf_consistent _null_ _null_ _null_ )); +DESCR("SP-GiST support for quad tree over range"); + +/* replication slots */ +DATA(insert OID = 3779 ( pg_create_physical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 1 0 2249 "19" "{19,19,3220}" "{i,o,o}" "{slot_name,slot_name,xlog_position}" _null_ pg_create_physical_replication_slot _null_ _null_ _null_ )); +DESCR("create a physical replication slot"); +DATA(insert OID = 3780 ( pg_drop_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 1 0 2278 "19" _null_ _null_ _null_ _null_ pg_drop_replication_slot _null_ _null_ _null_ )); +DESCR("drop a replication slot"); +DATA(insert OID = 3781 ( pg_get_replication_slots PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{19,19,25,26,16,28,28,3220}" "{o,o,o,o,o,o,o,o}" "{slot_name,plugin,slot_type,datoid,active,xmin,catalog_xmin,restart_lsn}" _null_ pg_get_replication_slots _null_ _null_ _null_ )); +DESCR("information about replication slots currently in use"); +DATA(insert OID = 3786 ( pg_create_logical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 2 0 2249 "19 19" "{19,19,25,3220}" "{i,i,o,o}" "{slot_name,plugin,slot_name,xlog_position}" _null_ pg_create_logical_replication_slot _null_ _null_ _null_ )); +DESCR("set up a logical replication slot"); +DATA(insert OID = 3782 ( pg_logical_slot_get_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,25}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ pg_logical_slot_get_changes _null_ _null_ _null_ )); +DESCR("get changes from replication slot"); +DATA(insert OID = 3783 ( pg_logical_slot_get_binary_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,17}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ pg_logical_slot_get_binary_changes _null_ _null_ _null_ )); +DESCR("get binary changes from replication slot"); +DATA(insert OID = 3784 ( pg_logical_slot_peek_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,25}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ pg_logical_slot_peek_changes _null_ _null_ _null_ )); +DESCR("peek at changes from replication slot"); +DATA(insert OID = 3785 ( pg_logical_slot_peek_binary_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,17}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ pg_logical_slot_peek_binary_changes _null_ _null_ _null_ )); +DESCR("peek at binary changes from replication slot"); + +/* event triggers */ +DATA(insert OID = 3566 ( pg_event_trigger_dropped_objects PGNSP PGUID 12 10 100 0 0 f f f f t t s 0 0 2249 "" "{26,26,23,25,25,25,25}" "{o,o,o,o,o,o,o}" "{classid, objid, objsubid, object_type, schema_name, object_name, object_identity}" _null_ pg_event_trigger_dropped_objects _null_ _null_ _null_ )); +DESCR("list objects dropped by the current command"); + +/* generic transition functions for ordered-set aggregates */ +DATA(insert OID = 3970 ( ordered_set_transition PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2281 "2281 2276" _null_ _null_ _null_ _null_ ordered_set_transition _null_ _null_ _null_ )); +DESCR("aggregate transition function"); +DATA(insert OID = 3971 ( ordered_set_transition_multi PGNSP PGUID 12 1 0 2276 0 f f f f f f i 2 0 2281 "2281 2276" "{2281,2276}" "{i,v}" _null_ _null_ ordered_set_transition_multi _null_ _null_ _null_ )); +DESCR("aggregate transition function"); + +/* inverse distribution aggregates (and their support functions) */ +DATA(insert OID = 3972 ( percentile_disc PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 2283 "701 2283" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("discrete percentile"); +DATA(insert OID = 3973 ( percentile_disc_final PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2283 "2281 701 2283" _null_ _null_ _null_ _null_ percentile_disc_final _null_ _null_ _null_ )); +DESCR("aggregate final function"); +DATA(insert OID = 3974 ( percentile_cont PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("continuous distribution percentile"); +DATA(insert OID = 3975 ( percentile_cont_float8_final PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 701 "2281 701" _null_ _null_ _null_ _null_ percentile_cont_float8_final _null_ _null_ _null_ )); +DESCR("aggregate final function"); +DATA(insert OID = 3976 ( percentile_cont PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 1186 "701 1186" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("continuous distribution percentile"); +DATA(insert OID = 3977 ( percentile_cont_interval_final PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 1186 "2281 701" _null_ _null_ _null_ _null_ percentile_cont_interval_final _null_ _null_ _null_ )); +DESCR("aggregate final function"); +DATA(insert OID = 3978 ( percentile_disc PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 2277 "1022 2283" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("multiple discrete percentiles"); +DATA(insert OID = 3979 ( percentile_disc_multi_final PGNSP PGUID 12 1 0 0 0 f f f f f f i 3 0 2277 "2281 1022 2283" _null_ _null_ _null_ _null_ percentile_disc_multi_final _null_ _null_ _null_ )); +DESCR("aggregate final function"); +DATA(insert OID = 3980 ( percentile_cont PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 1022 "1022 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("multiple continuous percentiles"); +DATA(insert OID = 3981 ( percentile_cont_float8_multi_final PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 1022 "2281 1022" _null_ _null_ _null_ _null_ percentile_cont_float8_multi_final _null_ _null_ _null_ )); +DESCR("aggregate final function"); +DATA(insert OID = 3982 ( percentile_cont PGNSP PGUID 12 1 0 0 0 t f f f f f i 2 0 1187 "1022 1186" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("multiple continuous percentiles"); +DATA(insert OID = 3983 ( percentile_cont_interval_multi_final PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 1187 "2281 1022" _null_ _null_ _null_ _null_ percentile_cont_interval_multi_final _null_ _null_ _null_ )); +DESCR("aggregate final function"); +DATA(insert OID = 3984 ( mode PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 2283 "2283" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("most common value"); +DATA(insert OID = 3985 ( mode_final PGNSP PGUID 12 1 0 0 0 f f f f f f i 2 0 2283 "2281 2283" _null_ _null_ _null_ _null_ mode_final _null_ _null_ _null_ )); +DESCR("aggregate final function"); + +/* hypothetical-set aggregates (and their support functions) */ +DATA(insert OID = 3986 ( rank PGNSP PGUID 12 1 0 2276 0 t f f f f f i 1 0 20 "2276" "{2276}" "{v}" _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("rank of hypothetical row"); +DATA(insert OID = 3987 ( rank_final PGNSP PGUID 12 1 0 2276 0 f f f f f f i 2 0 20 "2281 2276" "{2281,2276}" "{i,v}" _null_ _null_ hypothetical_rank_final _null_ _null_ _null_ )); +DESCR("aggregate final function"); +DATA(insert OID = 3988 ( percent_rank PGNSP PGUID 12 1 0 2276 0 t f f f f f i 1 0 701 "2276" "{2276}" "{v}" _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("fractional rank of hypothetical row"); +DATA(insert OID = 3989 ( percent_rank_final PGNSP PGUID 12 1 0 2276 0 f f f f f f i 2 0 701 "2281 2276" "{2281,2276}" "{i,v}" _null_ _null_ hypothetical_percent_rank_final _null_ _null_ _null_ )); +DESCR("aggregate final function"); +DATA(insert OID = 3990 ( cume_dist PGNSP PGUID 12 1 0 2276 0 t f f f f f i 1 0 701 "2276" "{2276}" "{v}" _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("cumulative distribution of hypothetical row"); +DATA(insert OID = 3991 ( cume_dist_final PGNSP PGUID 12 1 0 2276 0 f f f f f f i 2 0 701 "2281 2276" "{2281,2276}" "{i,v}" _null_ _null_ hypothetical_cume_dist_final _null_ _null_ _null_ )); +DESCR("aggregate final function"); +DATA(insert OID = 3992 ( dense_rank PGNSP PGUID 12 1 0 2276 0 t f f f f f i 1 0 20 "2276" "{2276}" "{v}" _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DESCR("rank of hypothetical row without gaps"); +DATA(insert OID = 3993 ( dense_rank_final PGNSP PGUID 12 1 0 2276 0 f f f f f f i 2 0 20 "2281 2276" "{2281,2276}" "{i,v}" _null_ _null_ hypothetical_dense_rank_final _null_ _null_ _null_ )); +DESCR("aggregate final function"); #ifdef PGXC -DATA(insert OID = 3200 ( pgxc_pool_check PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pgxc_pool_check _null_ _null_ _null_ )); +DATA(insert OID = 6007 ( pgxc_pool_check PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pgxc_pool_check _null_ _null_ _null_ )); DESCR("check connection information consistency in pooler"); -DATA(insert OID = 3201 ( pgxc_pool_reload PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pgxc_pool_reload _null_ _null_ _null_ )); +DATA(insert OID = 6008 ( pgxc_pool_reload PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pgxc_pool_reload _null_ _null_ _null_ )); DESCR("reload connection information in pooler and reload server sessions"); -DATA(insert OID = 3202 ( pgxc_node_str PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ pgxc_node_str _null_ _null_ _null_ )); +DATA(insert OID = 6009 ( pgxc_node_str PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ pgxc_node_str _null_ _null_ _null_ )); DESCR("get the name of the node"); -DATA(insert OID = 3203 ( pgxc_is_committed PGNSP PGUID 12 1 1 0 0 f f f f t t s 1 0 16 "28" _null_ _null_ _null_ _null_ pgxc_is_committed _null_ _null_ _null_ )); +DATA(insert OID = 6010 ( pgxc_is_committed PGNSP PGUID 12 1 1 0 0 f f f f t t s 1 0 16 "28" _null_ _null_ _null_ _null_ pgxc_is_committed _null_ _null_ _null_ )); DESCR("is given GXID committed or aborted?"); -DATA(insert OID = 3205 ( pgxc_lock_for_backup PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pgxc_lock_for_backup _null_ _null_ _null_ )); +DATA(insert OID = 6011 ( pgxc_lock_for_backup PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pgxc_lock_for_backup _null_ _null_ _null_ )); DESCR("lock the cluster for taking backup"); #ifdef XCP -DATA(insert OID = 3204 ( stormdb_promote_standby PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2278 "" _null_ _null_ _null_ _null_ stormdb_promote_standby _null_ _null_ _null_ )); +DATA(insert OID = 6012 ( stormdb_promote_standby PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 2278 "" _null_ _null_ _null_ _null_ stormdb_promote_standby _null_ _null_ _null_ )); DESCR("touch trigger file on a standby machine to end replication"); #endif #endif @@ -4692,7 +5086,7 @@ DESCR("touch trigger file on a standby machine to end replication"); #define PROVOLATILE_VOLATILE 'v' /* can change even within a scan */ /* - * Symbolic values for proargmodes column. Note that these must agree with + * Symbolic values for proargmodes column. Note that these must agree with * the FunctionParameterMode enum in parsenodes.h; we declare them here to * be accessible from either header. */ diff --git a/src/include/catalog/pg_proc_fn.h b/src/include/catalog/pg_proc_fn.h index fcd09e7059..ab73bb50bf 100644 --- a/src/include/catalog/pg_proc_fn.h +++ b/src/include/catalog/pg_proc_fn.h @@ -4,7 +4,7 @@ * prototypes for functions in catalog/pg_proc.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_proc_fn.h diff --git a/src/include/catalog/pg_range.h b/src/include/catalog/pg_range.h index 9b2be92fc9..664e771a4f 100644 --- a/src/include/catalog/pg_range.h +++ b/src/include/catalog/pg_range.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_range.h diff --git a/src/include/catalog/pg_rewrite.h b/src/include/catalog/pg_rewrite.h index 5171522da0..37629fef3b 100644 --- a/src/include/catalog/pg_rewrite.h +++ b/src/include/catalog/pg_rewrite.h @@ -8,7 +8,7 @@ * --- ie, rule names are only unique among the rules of a given table. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_rewrite.h @@ -25,7 +25,7 @@ #include "catalog/genbki.h" /* ---------------- - * pg_rewrite definition. cpp turns this into + * pg_rewrite definition. cpp turns this into * typedef struct FormData_pg_rewrite * ---------------- */ @@ -35,7 +35,6 @@ CATALOG(pg_rewrite,2618) { NameData rulename; Oid ev_class; - int2 ev_attr; char ev_type; char ev_enabled; bool is_instead; @@ -57,14 +56,13 @@ typedef FormData_pg_rewrite *Form_pg_rewrite; * compiler constants for pg_rewrite * ---------------- */ -#define Natts_pg_rewrite 8 +#define Natts_pg_rewrite 7 #define Anum_pg_rewrite_rulename 1 #define Anum_pg_rewrite_ev_class 2 -#define Anum_pg_rewrite_ev_attr 3 -#define Anum_pg_rewrite_ev_type 4 -#define Anum_pg_rewrite_ev_enabled 5 -#define Anum_pg_rewrite_is_instead 6 -#define Anum_pg_rewrite_ev_qual 7 -#define Anum_pg_rewrite_ev_action 8 +#define Anum_pg_rewrite_ev_type 3 +#define Anum_pg_rewrite_ev_enabled 4 +#define Anum_pg_rewrite_is_instead 5 +#define Anum_pg_rewrite_ev_qual 6 +#define Anum_pg_rewrite_ev_action 7 #endif /* PG_REWRITE_H */ diff --git a/src/include/catalog/pg_seclabel.h b/src/include/catalog/pg_seclabel.h index 917efcf8ca..3c219468fd 100644 --- a/src/include/catalog/pg_seclabel.h +++ b/src/include/catalog/pg_seclabel.h @@ -3,7 +3,7 @@ * pg_seclabel.h * definition of the system "security label" relation (pg_seclabel) * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * ------------------------------------------------------------------------- @@ -24,7 +24,7 @@ CATALOG(pg_seclabel,3596) BKI_WITHOUT_OIDS { Oid objoid; /* OID of the object itself */ Oid classoid; /* OID of table containing the object */ - int4 objsubid; /* column number, or 0 if not used */ + int32 objsubid; /* column number, or 0 if not used */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text provider; /* name of label provider */ diff --git a/src/include/catalog/pg_shdepend.h b/src/include/catalog/pg_shdepend.h index 394fe43c58..346dc2e393 100644 --- a/src/include/catalog/pg_shdepend.h +++ b/src/include/catalog/pg_shdepend.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_shdepend.h @@ -33,13 +33,13 @@ CATALOG(pg_shdepend,1214) BKI_SHARED_RELATION BKI_WITHOUT_OIDS /* * Identification of the dependent (referencing) object. * - * These fields are all zeroes for a DEPENDENCY_PIN entry. Also, dbid can + * These fields are all zeroes for a DEPENDENCY_PIN entry. Also, dbid can * be zero to denote a shared object. */ Oid dbid; /* OID of database containing object */ Oid classid; /* OID of table containing object */ Oid objid; /* OID of object itself */ - int4 objsubid; /* column number, or 0 if not used */ + int32 objsubid; /* column number, or 0 if not used */ /* * Identification of the independent (referenced) object. This is always diff --git a/src/include/catalog/pg_shdescription.h b/src/include/catalog/pg_shdescription.h index acd529b875..50a516ad1c 100644 --- a/src/include/catalog/pg_shdescription.h +++ b/src/include/catalog/pg_shdescription.h @@ -7,12 +7,12 @@ * NOTE: an object is identified by the OID of the row that primarily * defines the object, plus the OID of the table that that row appears in. * For example, a database is identified by the OID of its pg_database row - * plus the pg_class OID of table pg_database. This allows unique + * plus the pg_class OID of table pg_database. This allows unique * identification of objects without assuming that OIDs are unique * across tables. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_shdescription.h @@ -32,7 +32,7 @@ #include "catalog/genbki.h" /* ---------------- - * pg_shdescription definition. cpp turns this into + * pg_shdescription definition. cpp turns this into * typedef struct FormData_pg_shdescription * ---------------- */ diff --git a/src/include/catalog/pg_shseclabel.h b/src/include/catalog/pg_shseclabel.h index 3d7a013e8c..409a56a0af 100644 --- a/src/include/catalog/pg_shseclabel.h +++ b/src/include/catalog/pg_shseclabel.h @@ -3,7 +3,7 @@ * pg_shseclabel.h * definition of the system "security label" relation (pg_shseclabel) * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * ------------------------------------------------------------------------- diff --git a/src/include/catalog/pg_statistic.h b/src/include/catalog/pg_statistic.h index 3ad0c28110..e6c00f619f 100644 --- a/src/include/catalog/pg_statistic.h +++ b/src/include/catalog/pg_statistic.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_statistic.h @@ -32,14 +32,14 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS { /* These fields form the unique key for the entry: */ Oid starelid; /* relation containing attribute */ - int2 staattnum; /* attribute (column) stats are for */ + int16 staattnum; /* attribute (column) stats are for */ bool stainherit; /* true if inheritance children are included */ /* the fraction of the column's entries that are NULL: */ float4 stanullfrac; /* - * stawidth is the average width in bytes of non-null entries. For + * stawidth is the average width in bytes of non-null entries. For * fixed-width datatypes this is of course the same as the typlen, but for * var-width types it is more useful. Note that this is the average width * of the data as actually stored, post-TOASTing (eg, for a @@ -48,7 +48,7 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS * the statistic, which is to estimate sizes of in-memory hash tables of * tuples. */ - int4 stawidth; + int32 stawidth; /* ---------------- * stadistinct indicates the (approximate) number of distinct non-null @@ -59,7 +59,7 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS * The special negative case allows us to cope with columns that are * unique (stadistinct = -1) or nearly so (for example, a column in * which values appear about twice on the average could be represented - * by stadistinct = -0.5). Because the number-of-rows statistic in + * by stadistinct = -0.5). Because the number-of-rows statistic in * pg_class may be updated more frequently than pg_statistic is, it's * important to be able to describe such situations as a multiple of * the number of rows, rather than a fixed number of distinct values. @@ -71,8 +71,8 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS /* ---------------- * To allow keeping statistics on different kinds of datatypes, * we do not hard-wire any particular meaning for the remaining - * statistical fields. Instead, we provide several "slots" in which - * statistical data can be placed. Each slot includes: + * statistical fields. Instead, we provide several "slots" in which + * statistical data can be placed. Each slot includes: * kind integer code identifying kind of data (see below) * op OID of associated operator, if needed * numbers float4 array (for statistical values) @@ -84,11 +84,11 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS * ---------------- */ - int2 stakind1; - int2 stakind2; - int2 stakind3; - int2 stakind4; - int2 stakind5; + int16 stakind1; + int16 stakind2; + int16 stakind3; + int16 stakind4; + int16 stakind5; Oid staop1; Oid staop2; @@ -105,7 +105,7 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS /* * Values in these arrays are values of the column's data type, or of some - * related type such as an array element type. We presently have to cheat + * related type such as an array element type. We presently have to cheat * quite a bit to allow polymorphic arrays of this kind, but perhaps * someday it'll be a less bogus facility. */ @@ -168,8 +168,8 @@ typedef FormData_pg_statistic *Form_pg_statistic; * operators. * * Code reading the pg_statistic relation should not assume that a particular - * data "kind" will appear in any particular slot. Instead, search the - * stakind fields to see if the desired data is available. (The standard + * data "kind" will appear in any particular slot. Instead, search the + * stakind fields to see if the desired data is available. (The standard * function get_attstatsslot() may be used for this.) */ @@ -196,7 +196,7 @@ typedef FormData_pg_statistic *Form_pg_statistic; * the K most common non-null values appearing in the column, and stanumbers * contains their frequencies (fractions of total row count). The values * shall be ordered in decreasing frequency. Note that since the arrays are - * variable-size, K may be chosen by the statistics collector. Values should + * variable-size, K may be chosen by the statistics collector. Values should * not appear in MCV unless they have been observed to occur more than once; * a unique column will have no MCV slot. */ @@ -208,13 +208,13 @@ typedef FormData_pg_statistic *Form_pg_statistic; * more than one histogram could appear, if a datatype has more than one * useful sort operator.) stavalues contains M (>=2) non-null values that * divide the non-null column data values into M-1 bins of approximately equal - * population. The first stavalues item is the MIN and the last is the MAX. + * population. The first stavalues item is the MIN and the last is the MAX. * stanumbers is not used and should be NULL. IMPORTANT POINT: if an MCV * slot is also provided, then the histogram describes the data distribution * *after removing the values listed in MCV* (thus, it's a "compressed * histogram" in the technical parlance). This allows a more accurate * representation of the distribution of a column with some very-common - * values. In a column with only a few distinct values, it's possible that + * values. In a column with only a few distinct values, it's possible that * the MCV list describes the entire data population; in this case the * histogram reduces to empty and should be omitted. */ @@ -225,7 +225,7 @@ typedef FormData_pg_statistic *Form_pg_statistic; * of table tuples and the ordering of data values of this column, as seen * by the "<" operator identified by staop. (As with the histogram, more * than one entry could theoretically appear.) stavalues is not used and - * should be NULL. stanumbers contains a single entry, the correlation + * should be NULL. stanumbers contains a single entry, the correlation * coefficient between the sequence of data values and the sequence of * their actual tuple positions. The coefficient ranges from +1 to -1. */ @@ -234,7 +234,7 @@ typedef FormData_pg_statistic *Form_pg_statistic; /* * A "most common elements" slot is similar to a "most common values" slot, * except that it stores the most common non-null *elements* of the column - * values. This is useful when the column datatype is an array or some other + * values. This is useful when the column datatype is an array or some other * type with identifiable elements (for instance, tsvector). staop contains * the equality operator appropriate to the element type. stavalues contains * the most common element values, and stanumbers their frequencies. Unlike @@ -258,7 +258,7 @@ typedef FormData_pg_statistic *Form_pg_statistic; /* * A "distinct elements count histogram" slot describes the distribution of * the number of distinct element values present in each row of an array-type - * column. Only non-null rows are considered, and only non-null elements. + * column. Only non-null rows are considered, and only non-null elements. * staop contains the equality operator appropriate to the element type. * stavalues is not used and should be NULL. The last member of stanumbers is * the average count of distinct element values over all non-null rows. The @@ -268,4 +268,26 @@ typedef FormData_pg_statistic *Form_pg_statistic; */ #define STATISTIC_KIND_DECHIST 5 +/* + * A "length histogram" slot describes the distribution of range lengths in + * rows of a range-type column. stanumbers contains a single entry, the + * fraction of empty ranges. stavalues is a histogram of non-empty lengths, in + * a format similar to STATISTIC_KIND_HISTOGRAM: it contains M (>=2) range + * values that divide the column data values into M-1 bins of approximately + * equal population. The lengths are stores as float8s, as measured by the + * range type's subdiff function. Only non-null rows are considered. + */ +#define STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM 6 + +/* + * A "bounds histogram" slot is similar to STATISTIC_KIND_HISTOGRAM, but for + * a range-type column. stavalues contains M (>=2) range values that divide + * the column data values into M-1 bins of approximately equal population. + * Unlike a regular scalar histogram, this is actually two histograms combined + * into a single array, with the lower bounds of each value forming a + * histogram of lower bounds, and the upper bounds a histogram of upper + * bounds. Only non-NULL, non-empty ranges are included. + */ +#define STATISTIC_KIND_BOUNDS_HISTOGRAM 7 + #endif /* PG_STATISTIC_H */ diff --git a/src/include/catalog/pg_tablespace.h b/src/include/catalog/pg_tablespace.h index 777a8a1778..41fad464cf 100644 --- a/src/include/catalog/pg_tablespace.h +++ b/src/include/catalog/pg_tablespace.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_tablespace.h diff --git a/src/include/catalog/pg_trigger.h b/src/include/catalog/pg_trigger.h index 71afab58e5..600a2f76c6 100644 --- a/src/include/catalog/pg_trigger.h +++ b/src/include/catalog/pg_trigger.h @@ -5,7 +5,7 @@ * along with the relation's initial contents. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_trigger.h @@ -22,7 +22,7 @@ #include "catalog/genbki.h" /* ---------------- - * pg_trigger definition. cpp turns this into + * pg_trigger definition. cpp turns this into * typedef struct FormData_pg_trigger * * Note: when tgconstraint is nonzero, tgconstrrelid, tgconstrindid, @@ -38,7 +38,7 @@ CATALOG(pg_trigger,2620) Oid tgrelid; /* relation trigger is attached to */ NameData tgname; /* trigger's name */ Oid tgfoid; /* OID of function to be called */ - int2 tgtype; /* BEFORE/AFTER/INSTEAD, UPDATE/DELETE/INSERT, + int16 tgtype; /* BEFORE/AFTER/INSTEAD, UPDATE/DELETE/INSERT, * ROW/STATEMENT; see below */ char tgenabled; /* trigger's firing configuration WRT * session_replication_role */ @@ -48,7 +48,7 @@ CATALOG(pg_trigger,2620) Oid tgconstraint; /* associated pg_constraint entry, if any */ bool tgdeferrable; /* constraint trigger is deferrable */ bool tginitdeferred; /* constraint trigger is deferred initially */ - int2 tgnargs; /* # of extra arguments in tgargs */ + int16 tgnargs; /* # of extra arguments in tgargs */ /* * Variable-length fields start here, but we allow direct access to diff --git a/src/include/catalog/pg_ts_config.h b/src/include/catalog/pg_ts_config.h index 5b7b1acbd5..52e32ddf2f 100644 --- a/src/include/catalog/pg_ts_config.h +++ b/src/include/catalog/pg_ts_config.h @@ -4,7 +4,7 @@ * definition of configuration of tsearch * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_ts_config.h diff --git a/src/include/catalog/pg_ts_config_map.h b/src/include/catalog/pg_ts_config_map.h index c377338174..a682a1ae80 100644 --- a/src/include/catalog/pg_ts_config_map.h +++ b/src/include/catalog/pg_ts_config_map.h @@ -4,7 +4,7 @@ * definition of token mappings for configurations of tsearch * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_ts_config_map.h @@ -33,8 +33,8 @@ CATALOG(pg_ts_config_map,3603) BKI_WITHOUT_OIDS { Oid mapcfg; /* OID of configuration owning this entry */ - int4 maptokentype; /* token type from parser */ - int4 mapseqno; /* order in which to consult dictionaries */ + int32 maptokentype; /* token type from parser */ + int32 mapseqno; /* order in which to consult dictionaries */ Oid mapdict; /* dictionary to consult */ } FormData_pg_ts_config_map; diff --git a/src/include/catalog/pg_ts_dict.h b/src/include/catalog/pg_ts_dict.h index 677a870b77..0968aeeada 100644 --- a/src/include/catalog/pg_ts_dict.h +++ b/src/include/catalog/pg_ts_dict.h @@ -4,7 +4,7 @@ * definition of dictionaries for tsearch * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_ts_dict.h @@ -24,7 +24,7 @@ #include "catalog/genbki.h" /* ---------------- - * pg_ts_dict definition. cpp turns this into + * pg_ts_dict definition. cpp turns this into * typedef struct FormData_pg_ts_dict * ---------------- */ diff --git a/src/include/catalog/pg_ts_parser.h b/src/include/catalog/pg_ts_parser.h index e892d1f5fc..b1b726f8e2 100644 --- a/src/include/catalog/pg_ts_parser.h +++ b/src/include/catalog/pg_ts_parser.h @@ -4,7 +4,7 @@ * definition of parsers for tsearch * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_ts_parser.h diff --git a/src/include/catalog/pg_ts_template.h b/src/include/catalog/pg_ts_template.h index 813912ee96..504075b99b 100644 --- a/src/include/catalog/pg_ts_template.h +++ b/src/include/catalog/pg_ts_template.h @@ -4,7 +4,7 @@ * definition of dictionary templates for tsearch * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_ts_template.h @@ -24,7 +24,7 @@ #include "catalog/genbki.h" /* ---------------- - * pg_ts_template definition. cpp turns this into + * pg_ts_template definition. cpp turns this into * typedef struct FormData_pg_ts_template * ---------------- */ diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index f87ec04655..756c161e0c 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -10,7 +10,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_type.h @@ -47,16 +47,16 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO /* * For a fixed-size type, typlen is the number of bytes we use to - * represent a value of this type, e.g. 4 for an int4. But for a + * represent a value of this type, e.g. 4 for an int4. But for a * variable-length type, typlen is negative. We use -1 to indicate a * "varlena" type (one that has a length word), -2 to indicate a * null-terminated C string. */ - int2 typlen; + int16 typlen; /* * typbyval determines whether internal Postgres routines pass a value of - * this type by value or by reference. typbyval had better be FALSE if + * this type by value or by reference. typbyval had better be FALSE if * the length is not 1, 2, or 4 (or 8 on 8-byte-Datum machines). * Variable-length types are always passed by reference. Note that * typbyval can be false even if the length would allow pass-by-value; @@ -76,7 +76,7 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO /* * typcategory and typispreferred help the parser distinguish preferred * and non-preferred coercions. The category can be any single ASCII - * character (but not \0). The categories used for built-in types are + * character (but not \0). The categories used for built-in types are * identified by the TYPCATEGORY macros below. */ char typcategory; /* arbitrary type classification */ @@ -85,7 +85,7 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO /* * If typisdefined is false, the entry is only a placeholder (forward - * reference). We know the type name, but not yet anything else about it. + * reference). We know the type name, but not yet anything else about it. */ bool typisdefined; @@ -146,7 +146,7 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO * 'd' = DOUBLE alignment (8 bytes on many machines, but by no means all). * * See include/access/tupmacs.h for the macros that compute these - * alignment requirements. Note also that we allow the nominal alignment + * alignment requirements. Note also that we allow the nominal alignment * to be violated when storing "packed" varlenas; the TOAST mechanism * takes care of hiding that from most code. * @@ -181,7 +181,7 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO /* * Domains use typbasetype to show the base (or domain) type that the - * domain is based on. Zero if the type is not a domain. + * domain is based on. Zero if the type is not a domain. */ Oid typbasetype; @@ -190,13 +190,13 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO * type (-1 if base type does not use a typmod). -1 if this type is not a * domain. */ - int4 typtypmod; + int32 typtypmod; /* * typndims is the declared number of dimensions for an array domain type * (i.e., typbasetype is an array type). Otherwise zero. */ - int4 typndims; + int32 typndims; /* * Collation: 0 if type cannot use collations, DEFAULT_COLLATION_OID for @@ -397,11 +397,10 @@ DATA(insert OID = 604 ( polygon PGNSP PGUID -1 f b G f t \054 0 0 1027 poly_ DESCR("geometric polygon '(pt1,...)'"); #define POLYGONOID 604 -DATA(insert OID = 628 ( line PGNSP PGUID 32 f b G f t \054 0 701 629 line_in line_out line_recv line_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ )); -DESCR("geometric line (not implemented)"); +DATA(insert OID = 628 ( line PGNSP PGUID 24 f b G f t \054 0 701 629 line_in line_out line_recv line_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ )); +DESCR("geometric line"); #define LINEOID 628 DATA(insert OID = 629 ( _line PGNSP PGUID -1 f b A f t \054 0 628 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); -DESCR(""); /* OIDS 700 - 799 */ @@ -452,6 +451,7 @@ DATA(insert OID = 1001 ( _bytea PGNSP PGUID -1 f b A f t \054 0 17 0 array_in DATA(insert OID = 1002 ( _char PGNSP PGUID -1 f b A f t \054 0 18 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1003 ( _name PGNSP PGUID -1 f b A f t \054 0 19 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1005 ( _int2 PGNSP PGUID -1 f b A f t \054 0 21 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); +#define INT2ARRAYOID 1005 DATA(insert OID = 1006 ( _int2vector PGNSP PGUID -1 f b A f t \054 0 22 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1007 ( _int4 PGNSP PGUID -1 f b A f t \054 0 23 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); #define INT4ARRAYOID 1007 @@ -459,6 +459,7 @@ DATA(insert OID = 1008 ( _regproc PGNSP PGUID -1 f b A f t \054 0 24 0 array_i DATA(insert OID = 1009 ( _text PGNSP PGUID -1 f b A f t \054 0 25 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 100 _null_ _null_ _null_ )); #define TEXTARRAYOID 1009 DATA(insert OID = 1028 ( _oid PGNSP PGUID -1 f b A f t \054 0 26 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); +#define OIDARRAYOID 1028 DATA(insert OID = 1010 ( _tid PGNSP PGUID -1 f b A f t \054 0 27 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1011 ( _xid PGNSP PGUID -1 f b A f t \054 0 28 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 1012 ( _cid PGNSP PGUID -1 f b A f t \054 0 29 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); @@ -578,11 +579,15 @@ DATA(insert OID = 2211 ( _regtype PGNSP PGUID -1 f b A f t \054 0 2206 0 arra /* uuid */ DATA(insert OID = 2950 ( uuid PGNSP PGUID 16 f b U f t \054 0 0 2951 uuid_in uuid_out uuid_recv uuid_send - - - c p f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("UUID datatype"); -#ifdef XCP -#define UUIDOID 2950 -#endif +#define UUIDOID 2950 DATA(insert OID = 2951 ( _uuid PGNSP PGUID -1 f b A f t \054 0 2950 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); +/* pg_lsn */ +DATA(insert OID = 3220 ( pg_lsn PGNSP PGUID 8 FLOAT8PASSBYVAL b U f t \054 0 0 3221 pg_lsn_in pg_lsn_out pg_lsn_recv pg_lsn_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ )); +DESCR("PostgreSQL LSN datatype"); +#define LSNOID 3220 +DATA(insert OID = 3221 ( _pg_lsn PGNSP PGUID -1 f b A f t \054 0 3220 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); + /* text search */ DATA(insert OID = 3614 ( tsvector PGNSP PGUID -1 f b U f t \054 0 0 3643 tsvectorin tsvectorout tsvectorrecv tsvectorsend - - ts_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("text representation for text search"); @@ -606,6 +611,12 @@ DATA(insert OID = 3645 ( _tsquery PGNSP PGUID -1 f b A f t \054 0 3615 0 array_ DATA(insert OID = 3735 ( _regconfig PGNSP PGUID -1 f b A f t \054 0 3734 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); DATA(insert OID = 3770 ( _regdictionary PGNSP PGUID -1 f b A f t \054 0 3769 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); +/* jsonb */ +DATA(insert OID = 3802 ( jsonb PGNSP PGUID -1 f b U f t \054 0 0 3807 jsonb_in jsonb_out jsonb_recv jsonb_send - - - i x f 0 -1 0 0 _null_ _null_ _null_ )); +DESCR("Binary JSON"); +#define JSONBOID 3802 +DATA(insert OID = 3807 ( _jsonb PGNSP PGUID -1 f b A f t \054 0 3802 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ )); + DATA(insert OID = 2970 ( txid_snapshot PGNSP PGUID -1 f b U f t \054 0 0 2949 txid_snapshot_in txid_snapshot_out txid_snapshot_recv txid_snapshot_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ )); DESCR("txid snapshot"); DATA(insert OID = 2949 ( _txid_snapshot PGNSP PGUID -1 f b A f t \054 0 2970 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ )); @@ -658,6 +669,8 @@ DATA(insert OID = 2278 ( void PGNSP PGUID 4 t p P f t \054 0 0 0 void_in void #define VOIDOID 2278 DATA(insert OID = 2279 ( trigger PGNSP PGUID 4 t p P f t \054 0 0 0 trigger_in trigger_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); #define TRIGGEROID 2279 +DATA(insert OID = 3838 ( event_trigger PGNSP PGUID 4 t p P f t \054 0 0 0 event_trigger_in event_trigger_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); +#define EVTTRIGGEROID 3838 DATA(insert OID = 2280 ( language_handler PGNSP PGUID 4 t p P f t \054 0 0 0 language_handler_in language_handler_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ )); #define LANGUAGE_HANDLEROID 2280 DATA(insert OID = 2281 ( internal PGNSP PGUID SIZEOF_POINTER t p P f t \054 0 0 0 internal_in internal_out - - - - - ALIGNOF_POINTER p f 0 -1 0 0 _null_ _null_ _null_ )); diff --git a/src/include/catalog/pg_type_fn.h b/src/include/catalog/pg_type_fn.h index 30109b964a..234d706c1e 100644 --- a/src/include/catalog/pg_type_fn.h +++ b/src/include/catalog/pg_type_fn.h @@ -4,7 +4,7 @@ * prototypes for functions in catalog/pg_type.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_type_fn.h diff --git a/src/include/catalog/pg_user_mapping.h b/src/include/catalog/pg_user_mapping.h index 1d2f9b0bd0..3144234798 100644 --- a/src/include/catalog/pg_user_mapping.h +++ b/src/include/catalog/pg_user_mapping.h @@ -3,7 +3,7 @@ * pg_user_mapping.h * definition of the system "user mapping" relation (pg_user_mapping) * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/pg_user_mapping.h diff --git a/src/include/catalog/pgxc_class.h b/src/include/catalog/pgxc_class.h index cb540bf584..164dbd9afc 100644 --- a/src/include/catalog/pgxc_class.h +++ b/src/include/catalog/pgxc_class.h @@ -12,9 +12,9 @@ CATALOG(pgxc_class,9001) BKI_WITHOUT_OIDS { Oid pcrelid; /* Table Oid */ char pclocatortype; /* Type of distribution */ - int2 pcattnum; /* Column number of distribution */ - int2 pchashalgorithm; /* Hashing algorithm */ - int2 pchashbuckets; /* Number of buckets */ + int16 pcattnum; /* Column number of distribution */ + int16 pchashalgorithm; /* Hashing algorithm */ + int16 pchashbuckets; /* Number of buckets */ /* VARIABLE LENGTH FIELDS: */ oidvector nodeoids; /* List of nodes used by table */ diff --git a/src/include/catalog/pgxc_node.h b/src/include/catalog/pgxc_node.h index e272243956..c55633cddd 100644 --- a/src/include/catalog/pgxc_node.h +++ b/src/include/catalog/pgxc_node.h @@ -36,7 +36,7 @@ CATALOG(pgxc_node,9015) BKI_SHARED_RELATION /* * Port number of the node to connect to */ - int4 node_port; + int32 node_port; /* * Host name of IP address of the node to connect to @@ -56,7 +56,7 @@ CATALOG(pgxc_node,9015) BKI_SHARED_RELATION /* * Node identifier to be used at places where a fixed length node identification is required */ - int4 node_id; + int32 node_id; } FormData_pgxc_node; typedef FormData_pgxc_node *Form_pgxc_node; diff --git a/src/include/catalog/storage.h b/src/include/catalog/storage.h index d5103a88f4..4b87a36191 100644 --- a/src/include/catalog/storage.h +++ b/src/include/catalog/storage.h @@ -4,7 +4,7 @@ * prototypes for functions in backend/catalog/storage.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/storage.h @@ -14,7 +14,6 @@ #ifndef STORAGE_H #define STORAGE_H -#include "access/xlog.h" #include "storage/block.h" #include "storage/relfilenode.h" #include "utils/relcache.h" @@ -34,9 +33,4 @@ extern void AtSubCommit_smgr(void); extern void AtSubAbort_smgr(void); extern void PostPrepare_smgr(void); -extern void log_smgrcreate(RelFileNode *rnode, ForkNumber forkNum); - -extern void smgr_redo(XLogRecPtr lsn, XLogRecord *record); -extern void smgr_desc(StringInfo buf, uint8 xl_info, char *rec); - #endif /* STORAGE_H */ diff --git a/src/include/catalog/storage_xlog.h b/src/include/catalog/storage_xlog.h new file mode 100644 index 0000000000..43bf277f35 --- /dev/null +++ b/src/include/catalog/storage_xlog.h @@ -0,0 +1,49 @@ +/*------------------------------------------------------------------------- + * + * storage_xlog.h + * prototypes for XLog support for backend/catalog/storage.c + * + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/storage_xlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef STORAGE_XLOG_H +#define STORAGE_XLOG_H + +#include "access/xlog.h" +#include "storage/block.h" +#include "storage/relfilenode.h" + +/* + * Declarations for smgr-related XLOG records + * + * Note: we log file creation and truncation here, but logging of deletion + * actions is handled by xact.c, because it is part of transaction commit. + */ + +/* XLOG gives us high 4 bits */ +#define XLOG_SMGR_CREATE 0x10 +#define XLOG_SMGR_TRUNCATE 0x20 + +typedef struct xl_smgr_create +{ + RelFileNode rnode; + ForkNumber forkNum; +} xl_smgr_create; + +typedef struct xl_smgr_truncate +{ + BlockNumber blkno; + RelFileNode rnode; +} xl_smgr_truncate; + +extern void log_smgrcreate(RelFileNode *rnode, ForkNumber forkNum); + +extern void smgr_redo(XLogRecPtr lsn, XLogRecord *record); +extern void smgr_desc(StringInfo buf, uint8 xl_info, char *rec); + +#endif /* STORAGE_XLOG_H */ diff --git a/src/include/catalog/toasting.h b/src/include/catalog/toasting.h index 22211cbe3f..a4af551523 100644 --- a/src/include/catalog/toasting.h +++ b/src/include/catalog/toasting.h @@ -4,7 +4,7 @@ * This file provides some definitions to support creation of toast tables * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/catalog/toasting.h @@ -14,10 +14,16 @@ #ifndef TOASTING_H #define TOASTING_H +#include "storage/lock.h" + /* * toasting.c prototypes */ -extern void AlterTableCreateToastTable(Oid relOid, Datum reloptions); +extern void NewRelationCreateToastTable(Oid relOid, Datum reloptions); +extern void NewHeapCreateToastTable(Oid relOid, Datum reloptions, + LOCKMODE lockmode); +extern void AlterTableCreateToastTable(Oid relOid, Datum reloptions, + LOCKMODE lockmode); extern void BootstrapToastTable(char *relName, Oid toastOid, Oid toastIndexOid); diff --git a/src/include/commands/alter.h b/src/include/commands/alter.h index 210cf4eacd..5907184902 100644 --- a/src/include/commands/alter.h +++ b/src/include/commands/alter.h @@ -4,7 +4,7 @@ * prototypes for commands/alter.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/alter.h @@ -14,16 +14,18 @@ #ifndef ALTER_H #define ALTER_H -#include "utils/acl.h" +#include "catalog/dependency.h" +#include "nodes/parsenodes.h" #include "utils/relcache.h" -extern void ExecRenameStmt(RenameStmt *stmt); -extern void ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt); -extern Oid AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid); -extern Oid AlterObjectNamespace(Relation rel, int oidCacheId, int nameCacheId, - Oid objid, Oid nspOid, - int Anum_name, int Anum_namespace, int Anum_owner, - AclObjectKind acl_kind); -extern void ExecAlterOwnerStmt(AlterOwnerStmt *stmt); +extern Oid ExecRenameStmt(RenameStmt *stmt); + +extern Oid ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt); +extern Oid AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid, + ObjectAddresses *objsMoved); + +extern Oid ExecAlterOwnerStmt(AlterOwnerStmt *stmt); +extern void AlterObjectOwner_internal(Relation catalog, Oid objectId, + Oid new_ownerId); #endif /* ALTER_H */ diff --git a/src/include/commands/async.h b/src/include/commands/async.h index 3d1cf6873e..0650e654a5 100644 --- a/src/include/commands/async.h +++ b/src/include/commands/async.h @@ -3,7 +3,7 @@ * async.h * Asynchronous notification: NOTIFY, LISTEN, UNLISTEN * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/async.h diff --git a/src/include/commands/cluster.h b/src/include/commands/cluster.h index 21b2a58020..0ada3d6516 100644 --- a/src/include/commands/cluster.h +++ b/src/include/commands/cluster.h @@ -3,7 +3,7 @@ * cluster.h * header file for postgres cluster command stuff * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994-5, Regents of the University of California * * src/include/commands/cluster.h @@ -20,16 +20,19 @@ extern void cluster(ClusterStmt *stmt, bool isTopLevel); extern void cluster_rel(Oid tableOid, Oid indexOid, bool recheck, - bool verbose, int freeze_min_age, int freeze_table_age); + bool verbose); extern void check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck, LOCKMODE lockmode); -extern void mark_index_clustered(Relation rel, Oid indexOid); +extern void mark_index_clustered(Relation rel, Oid indexOid, bool is_internal); -extern Oid make_new_heap(Oid OIDOldHeap, Oid NewTableSpace); +extern Oid make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, bool forcetemp, + LOCKMODE lockmode); extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap, bool is_system_catalog, bool swap_toast_by_content, bool check_constraints, - TransactionId frozenXid); + bool is_internal, + TransactionId frozenXid, + MultiXactId minMulti); #endif /* CLUSTER_H */ diff --git a/src/include/commands/collationcmds.h b/src/include/commands/collationcmds.h index 0587c4f3ff..da95abcfb7 100644 --- a/src/include/commands/collationcmds.h +++ b/src/include/commands/collationcmds.h @@ -4,7 +4,7 @@ * prototypes for collationcmds.c. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/collationcmds.h @@ -17,11 +17,7 @@ #include "nodes/parsenodes.h" -extern void DefineCollation(List *names, List *parameters); -extern void RenameCollation(List *name, const char *newname); -extern void AlterCollationOwner(List *name, Oid newOwnerId); -extern void AlterCollationOwner_oid(Oid collationOid, Oid newOwnerId); -extern void AlterCollationNamespace(List *name, const char *newschema); -extern Oid AlterCollationNamespace_oid(Oid collOid, Oid newNspOid); +extern Oid DefineCollation(List *names, List *parameters); +extern void IsThereCollationInNamespace(const char *collname, Oid nspOid); #endif /* COLLATIONCMDS_H */ diff --git a/src/include/commands/comment.h b/src/include/commands/comment.h index 441d8bd253..05fe0c6744 100644 --- a/src/include/commands/comment.h +++ b/src/include/commands/comment.h @@ -7,7 +7,7 @@ * * Prototypes for functions in commands/comment.c * - * Copyright (c) 1999-2012, PostgreSQL Global Development Group + * Copyright (c) 1999-2014, PostgreSQL Global Development Group * *------------------------------------------------------------------------- */ @@ -24,12 +24,12 @@ * related routines. CommentObject() implements the SQL "COMMENT ON" * command. DeleteComments() deletes all comments for an object. * CreateComments creates (or deletes, if comment is NULL) a comment - * for a specific key. There are versions of these two methods for + * for a specific key. There are versions of these two methods for * both normal and shared objects. *------------------------------------------------------------------ */ -extern void CommentObject(CommentStmt *stmt); +extern Oid CommentObject(CommentStmt *stmt); extern void DeleteComments(Oid oid, Oid classoid, int32 subid); diff --git a/src/include/commands/conversioncmds.h b/src/include/commands/conversioncmds.h index 00f468f985..f7a445c5ad 100644 --- a/src/include/commands/conversioncmds.h +++ b/src/include/commands/conversioncmds.h @@ -4,7 +4,7 @@ * prototypes for conversioncmds.c. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/conversioncmds.h @@ -17,11 +17,6 @@ #include "nodes/parsenodes.h" -extern void CreateConversionCommand(CreateConversionStmt *parsetree); -extern void RenameConversion(List *name, const char *newname); -extern void AlterConversionOwner(List *name, Oid newOwnerId); -extern void AlterConversionOwner_oid(Oid conversionOid, Oid newOwnerId); -extern void AlterConversionNamespace(List *name, const char *newschema); -extern Oid AlterConversionNamespace_oid(Oid convOid, Oid newNspOid); +extern Oid CreateConversionCommand(CreateConversionStmt *parsetree); #endif /* CONVERSIONCMDS_H */ diff --git a/src/include/commands/copy.h b/src/include/commands/copy.h index 8680ac3ddc..ba0f1b3d76 100644 --- a/src/include/commands/copy.h +++ b/src/include/commands/copy.h @@ -4,7 +4,7 @@ * Definitions for using the POSTGRES copy command. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/copy.h @@ -21,11 +21,12 @@ /* CopyStateData is private in commands/copy.c */ typedef struct CopyStateData *CopyState; -extern uint64 DoCopy(const CopyStmt *stmt, const char *queryString); +extern Oid DoCopy(const CopyStmt *stmt, const char *queryString, + uint64 *processed); extern void ProcessCopyOptions(CopyState cstate, bool is_from, List *options); extern CopyState BeginCopyFrom(Relation rel, const char *filename, - List *attnamelist, List *options); + bool is_program, List *attnamelist, List *options); extern void EndCopyFrom(CopyState cstate); extern bool NextCopyFrom(CopyState cstate, ExprContext *econtext, Datum *values, bool *nulls, Oid *tupleOid); diff --git a/src/include/commands/createas.h b/src/include/commands/createas.h index 946c7e2cf1..c17d829a3c 100644 --- a/src/include/commands/createas.h +++ b/src/include/commands/createas.h @@ -4,7 +4,7 @@ * prototypes for createas.c. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/createas.h diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h index 3bb0450a6b..7be275371b 100644 --- a/src/include/commands/dbcommands.h +++ b/src/include/commands/dbcommands.h @@ -4,7 +4,7 @@ * Database management commands (create/drop database). * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/dbcommands.h @@ -52,12 +52,12 @@ typedef struct xl_dbase_drop_rec Oid tablespace_id; } xl_dbase_drop_rec; -extern void createdb(const CreatedbStmt *stmt); +extern Oid createdb(const CreatedbStmt *stmt); extern void dropdb(const char *dbname, bool missing_ok); -extern void RenameDatabase(const char *oldname, const char *newname); -extern void AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel); -extern void AlterDatabaseSet(AlterDatabaseSetStmt *stmt); -extern void AlterDatabaseOwner(const char *dbname, Oid newOwnerId); +extern Oid RenameDatabase(const char *oldname, const char *newname); +extern Oid AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel); +extern Oid AlterDatabaseSet(AlterDatabaseSetStmt *stmt); +extern Oid AlterDatabaseOwner(const char *dbname, Oid newOwnerId); extern Oid get_database_oid(const char *dbname, bool missingok); extern char *get_database_name(Oid dbid); diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index 8f3d2c358d..5ec9374aad 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -4,7 +4,7 @@ * POSTGRES define and remove utility definitions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/defrem.h @@ -15,152 +15,113 @@ #define DEFREM_H #include "nodes/parsenodes.h" +#include "utils/array.h" /* commands/dropcmds.c */ extern void RemoveObjects(DropStmt *stmt); /* commands/indexcmds.c */ -extern Oid DefineIndex(RangeVar *heapRelation, - char *indexRelationName, +extern Oid DefineIndex(Oid relationId, + IndexStmt *stmt, Oid indexRelationId, - Oid relFileNode, - char *accessMethodName, - char *tableSpaceName, - List *attributeList, - Expr *predicate, - List *options, - List *exclusionOpNames, - bool unique, - bool primary, - bool isconstraint, - bool deferrable, - bool initdeferred, bool is_alter_table, bool check_rights, bool skip_build, - bool quiet, - bool concurrent); -extern void ReindexIndex(RangeVar *indexRelation); -extern void ReindexTable(RangeVar *relation); -extern void ReindexDatabase(const char *databaseName, + bool quiet); +extern Oid ReindexIndex(RangeVar *indexRelation); +extern Oid ReindexTable(RangeVar *relation); +extern Oid ReindexDatabase(const char *databaseName, bool do_system, bool do_user); extern char *makeObjectName(const char *name1, const char *name2, const char *label); extern char *ChooseRelationName(const char *name1, const char *name2, const char *label, Oid namespaceid); -extern char *ChooseIndexName(const char *tabname, Oid namespaceId, - List *colnames, List *exclusionOpNames, - bool primary, bool isconstraint); -extern List *ChooseIndexColumnNames(List *indexElems); extern bool CheckIndexCompatible(Oid oldId, - RangeVar *heapRelation, char *accessMethodName, List *attributeList, List *exclusionOpNames); extern Oid GetDefaultOpClass(Oid type_id, Oid am_id); /* commands/functioncmds.c */ -extern void CreateFunction(CreateFunctionStmt *stmt, const char *queryString); +extern Oid CreateFunction(CreateFunctionStmt *stmt, const char *queryString); extern void RemoveFunctionById(Oid funcOid); extern void SetFunctionReturnType(Oid funcOid, Oid newRetType); extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType); -extern void RenameFunction(List *name, List *argtypes, const char *newname); -extern void AlterFunctionOwner(List *name, List *argtypes, Oid newOwnerId); -extern void AlterFunctionOwner_oid(Oid procOid, Oid newOwnerId); -extern void AlterFunction(AlterFunctionStmt *stmt); -extern void CreateCast(CreateCastStmt *stmt); +extern Oid AlterFunction(AlterFunctionStmt *stmt); +extern Oid CreateCast(CreateCastStmt *stmt); extern void DropCastById(Oid castOid); -extern void AlterFunctionNamespace(List *name, List *argtypes, bool isagg, - const char *newschema); -extern Oid AlterFunctionNamespace_oid(Oid procOid, Oid nspOid); +extern void IsThereFunctionInNamespace(const char *proname, int pronargs, + oidvector *proargtypes, Oid nspOid); extern void ExecuteDoStmt(DoStmt *stmt); extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok); +extern void interpret_function_parameter_list(List *parameters, + Oid languageOid, + bool is_aggregate, + const char *queryString, + oidvector **parameterTypes, + ArrayType **allParameterTypes, + ArrayType **parameterModes, + ArrayType **parameterNames, + List **parameterDefaults, + Oid *variadicArgType, + Oid *requiredResultType); /* commands/operatorcmds.c */ -extern void DefineOperator(List *names, List *parameters); +extern Oid DefineOperator(List *names, List *parameters); extern void RemoveOperatorById(Oid operOid); -extern void AlterOperatorOwner(List *name, TypeName *typeName1, - TypeName *typename2, Oid newOwnerId); -extern void AlterOperatorOwner_oid(Oid operOid, Oid newOwnerId); -extern void AlterOperatorNamespace(List *names, List *argtypes, const char *newschema); -extern Oid AlterOperatorNamespace_oid(Oid operOid, Oid newNspOid); /* commands/aggregatecmds.c */ -extern void DefineAggregate(List *name, List *args, bool oldstyle, - List *parameters); -extern void RenameAggregate(List *name, List *args, const char *newname); -extern void AlterAggregateOwner(List *name, List *args, Oid newOwnerId); +extern Oid DefineAggregate(List *name, List *args, bool oldstyle, + List *parameters, const char *queryString); /* commands/opclasscmds.c */ -extern void DefineOpClass(CreateOpClassStmt *stmt); -extern void DefineOpFamily(CreateOpFamilyStmt *stmt); -extern void AlterOpFamily(AlterOpFamilyStmt *stmt); +extern Oid DefineOpClass(CreateOpClassStmt *stmt); +extern Oid DefineOpFamily(CreateOpFamilyStmt *stmt); +extern Oid AlterOpFamily(AlterOpFamilyStmt *stmt); extern void RemoveOpClassById(Oid opclassOid); extern void RemoveOpFamilyById(Oid opfamilyOid); extern void RemoveAmOpEntryById(Oid entryOid); extern void RemoveAmProcEntryById(Oid entryOid); -extern void RenameOpClass(List *name, const char *access_method, const char *newname); -extern void RenameOpFamily(List *name, const char *access_method, const char *newname); -extern void AlterOpClassOwner(List *name, const char *access_method, Oid newOwnerId); -extern void AlterOpClassOwner_oid(Oid opclassOid, Oid newOwnerId); -extern void AlterOpClassNamespace(List *name, char *access_method, const char *newschema); -extern Oid AlterOpClassNamespace_oid(Oid opclassOid, Oid newNspOid); -extern void AlterOpFamilyOwner(List *name, const char *access_method, Oid newOwnerId); -extern void AlterOpFamilyOwner_oid(Oid opfamilyOid, Oid newOwnerId); -extern void AlterOpFamilyNamespace(List *name, char *access_method, const char *newschema); -extern Oid AlterOpFamilyNamespace_oid(Oid opfamilyOid, Oid newNspOid); +extern void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod, + Oid opcnamespace); +extern void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod, + Oid opfnamespace); extern Oid get_am_oid(const char *amname, bool missing_ok); extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok); extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok); /* commands/tsearchcmds.c */ -extern void DefineTSParser(List *names, List *parameters); -extern void RenameTSParser(List *oldname, const char *newname); -extern void AlterTSParserNamespace(List *name, const char *newschema); -extern Oid AlterTSParserNamespace_oid(Oid prsId, Oid newNspOid); +extern Oid DefineTSParser(List *names, List *parameters); extern void RemoveTSParserById(Oid prsId); -extern void DefineTSDictionary(List *names, List *parameters); -extern void RenameTSDictionary(List *oldname, const char *newname); +extern Oid DefineTSDictionary(List *names, List *parameters); extern void RemoveTSDictionaryById(Oid dictId); -extern void AlterTSDictionary(AlterTSDictionaryStmt *stmt); -extern void AlterTSDictionaryOwner(List *name, Oid newOwnerId); -extern void AlterTSDictionaryNamespace(List *name, const char *newschema); -extern Oid AlterTSDictionaryNamespace_oid(Oid dictId, Oid newNspOid); - -extern void DefineTSTemplate(List *names, List *parameters); -extern void RenameTSTemplate(List *oldname, const char *newname); -extern void AlterTSTemplateNamespace(List *name, const char *newschema); -extern Oid AlterTSTemplateNamespace_oid(Oid tmplId, Oid newNspOid); +extern Oid AlterTSDictionary(AlterTSDictionaryStmt *stmt); + +extern Oid DefineTSTemplate(List *names, List *parameters); extern void RemoveTSTemplateById(Oid tmplId); -extern void DefineTSConfiguration(List *names, List *parameters); -extern void RenameTSConfiguration(List *oldname, const char *newname); +extern Oid DefineTSConfiguration(List *names, List *parameters); extern void RemoveTSConfigurationById(Oid cfgId); -extern void AlterTSConfiguration(AlterTSConfigurationStmt *stmt); -extern void AlterTSConfigurationOwner(List *name, Oid newOwnerId); -extern void AlterTSConfigurationNamespace(List *name, const char *newschema); -extern Oid AlterTSConfigurationNamespace_oid(Oid cfgId, Oid newNspOid); +extern Oid AlterTSConfiguration(AlterTSConfigurationStmt *stmt); extern text *serialize_deflist(List *deflist); extern List *deserialize_deflist(Datum txt); /* commands/foreigncmds.c */ -extern void RenameForeignServer(const char *oldname, const char *newname); -extern void RenameForeignDataWrapper(const char *oldname, const char *newname); -extern void AlterForeignServerOwner(const char *name, Oid newOwnerId); +extern Oid AlterForeignServerOwner(const char *name, Oid newOwnerId); extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId); -extern void AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId); +extern Oid AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId); extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId); -extern void CreateForeignDataWrapper(CreateFdwStmt *stmt); -extern void AlterForeignDataWrapper(AlterFdwStmt *stmt); +extern Oid CreateForeignDataWrapper(CreateFdwStmt *stmt); +extern Oid AlterForeignDataWrapper(AlterFdwStmt *stmt); extern void RemoveForeignDataWrapperById(Oid fdwId); -extern void CreateForeignServer(CreateForeignServerStmt *stmt); -extern void AlterForeignServer(AlterForeignServerStmt *stmt); +extern Oid CreateForeignServer(CreateForeignServerStmt *stmt); +extern Oid AlterForeignServer(AlterForeignServerStmt *stmt); extern void RemoveForeignServerById(Oid srvId); -extern void CreateUserMapping(CreateUserMappingStmt *stmt); -extern void AlterUserMapping(AlterUserMappingStmt *stmt); -extern void RemoveUserMapping(DropUserMappingStmt *stmt); +extern Oid CreateUserMapping(CreateUserMappingStmt *stmt); +extern Oid AlterUserMapping(AlterUserMappingStmt *stmt); +extern Oid RemoveUserMapping(DropUserMappingStmt *stmt); extern void RemoveUserMappingById(Oid umId); extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid); extern Datum transformGenericOptions(Oid catalogId, @@ -173,6 +134,7 @@ extern Datum transformGenericOptions(Oid catalogId, extern char *defGetString(DefElem *def); extern double defGetNumeric(DefElem *def); extern bool defGetBoolean(DefElem *def); +extern int32 defGetInt32(DefElem *def); extern int64 defGetInt64(DefElem *def); extern List *defGetQualifiedName(DefElem *def); extern TypeName *defGetTypeName(DefElem *def); diff --git a/src/include/commands/discard.h b/src/include/commands/discard.h index 450f04d4ef..1412aa2815 100644 --- a/src/include/commands/discard.h +++ b/src/include/commands/discard.h @@ -4,7 +4,7 @@ * prototypes for discard.c. * * - * Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Copyright (c) 1996-2014, PostgreSQL Global Development Group * * src/include/commands/discard.h * diff --git a/src/include/commands/event_trigger.h b/src/include/commands/event_trigger.h new file mode 100644 index 0000000000..0233f4c483 --- /dev/null +++ b/src/include/commands/event_trigger.h @@ -0,0 +1,55 @@ +/*------------------------------------------------------------------------- + * + * event_trigger.h + * Declarations for command trigger handling. + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/event_trigger.h + * + *------------------------------------------------------------------------- + */ +#ifndef EVENT_TRIGGER_H +#define EVENT_TRIGGER_H + +#include "catalog/dependency.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_event_trigger.h" +#include "nodes/parsenodes.h" + +typedef struct EventTriggerData +{ + NodeTag type; + const char *event; /* event name */ + Node *parsetree; /* parse tree */ + const char *tag; /* command tag */ +} EventTriggerData; + +/* + * EventTriggerData is the node type that is passed as fmgr "context" info + * when a function is called by the event trigger manager. + */ +#define CALLED_AS_EVENT_TRIGGER(fcinfo) \ + ((fcinfo)->context != NULL && IsA((fcinfo)->context, EventTriggerData)) + +extern Oid CreateEventTrigger(CreateEventTrigStmt *stmt); +extern void RemoveEventTriggerById(Oid ctrigOid); +extern Oid get_event_trigger_oid(const char *trigname, bool missing_ok); + +extern Oid AlterEventTrigger(AlterEventTrigStmt *stmt); +extern Oid AlterEventTriggerOwner(const char *name, Oid newOwnerId); +extern void AlterEventTriggerOwner_oid(Oid, Oid newOwnerId); + +extern bool EventTriggerSupportsObjectType(ObjectType obtype); +extern bool EventTriggerSupportsObjectClass(ObjectClass objclass); +extern void EventTriggerDDLCommandStart(Node *parsetree); +extern void EventTriggerDDLCommandEnd(Node *parsetree); +extern void EventTriggerSQLDrop(Node *parsetree); + +extern bool EventTriggerBeginCompleteQuery(void); +extern void EventTriggerEndCompleteQuery(void); +extern bool trackDroppedObjectsNeeded(void); +extern void EventTriggerSQLDropAddObject(ObjectAddress *object); + +#endif /* EVENT_TRIGGER_H */ diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h index 54cdbb0205..7fa17ab568 100644 --- a/src/include/commands/explain.h +++ b/src/include/commands/explain.h @@ -3,7 +3,7 @@ * explain.h * prototypes for explain.c * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994-5, Regents of the University of California * * src/include/commands/explain.h @@ -14,6 +14,7 @@ #define EXPLAIN_H #include "executor/executor.h" +#include "lib/stringinfo.h" typedef enum ExplainFormat { @@ -40,6 +41,7 @@ typedef struct ExplainState /* other states */ PlannedStmt *pstmt; /* top of plan */ List *rtable; /* range table */ + List *rtable_names; /* alias names for RTEs */ int indent; /* current indentation level */ List *grouping_stack; /* format-specific grouping state */ } ExplainState; @@ -69,10 +71,11 @@ extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into, const char *queryString, ParamListInfo params); extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, - ExplainState *es, - const char *queryString, ParamListInfo params); + ExplainState *es, const char *queryString, + ParamListInfo params, const instr_time *planduration); extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc); +extern void ExplainPrintTriggers(ExplainState *es, QueryDesc *queryDesc); extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc); diff --git a/src/include/commands/extension.h b/src/include/commands/extension.h index 7fc8a927d3..2cf784b455 100644 --- a/src/include/commands/extension.h +++ b/src/include/commands/extension.h @@ -4,7 +4,7 @@ * Extension management commands (create/drop extension). * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/extension.h @@ -27,7 +27,7 @@ extern bool creating_extension; extern Oid CurrentExtensionObject; -extern void CreateExtension(CreateExtensionStmt *stmt); +extern Oid CreateExtension(CreateExtensionStmt *stmt); extern void RemoveExtensionById(Oid extId); @@ -36,13 +36,15 @@ extern Oid InsertExtensionTuple(const char *extName, Oid extOwner, Datum extConfig, Datum extCondition, List *requiredExtensions); -extern void ExecAlterExtensionStmt(AlterExtensionStmt *stmt); +extern Oid ExecAlterExtensionStmt(AlterExtensionStmt *stmt); -extern void ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *stmt); +extern Oid ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *stmt); extern Oid get_extension_oid(const char *extname, bool missing_ok); extern char *get_extension_name(Oid ext_oid); -extern void AlterExtensionNamespace(List *names, const char *newschema); +extern Oid AlterExtensionNamespace(List *names, const char *newschema); + +extern void AlterExtensionOwner_oid(Oid extensionOid, Oid newOwnerId); #endif /* EXTENSION_H */ diff --git a/src/include/commands/lockcmds.h b/src/include/commands/lockcmds.h index 804d345a81..3c43228e81 100644 --- a/src/include/commands/lockcmds.h +++ b/src/include/commands/lockcmds.h @@ -4,7 +4,7 @@ * prototypes for lockcmds.c. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/lockcmds.h diff --git a/src/include/commands/matview.h b/src/include/commands/matview.h new file mode 100644 index 0000000000..476b285078 --- /dev/null +++ b/src/include/commands/matview.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * matview.h + * prototypes for matview.c. + * + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/matview.h + * + *------------------------------------------------------------------------- + */ +#ifndef MATVIEW_H +#define MATVIEW_H + +#include "nodes/params.h" +#include "nodes/parsenodes.h" +#include "tcop/dest.h" +#include "utils/relcache.h" + + +extern void SetMatViewPopulatedState(Relation relation, bool newstate); + +extern void ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString, + ParamListInfo params, char *completionTag); + +extern DestReceiver *CreateTransientRelDestReceiver(Oid oid); + +extern bool MatViewIncrementalMaintenanceIsEnabled(void); + +#endif /* MATVIEW_H */ diff --git a/src/include/commands/portalcmds.h b/src/include/commands/portalcmds.h index 2353ffb317..6627de1262 100644 --- a/src/include/commands/portalcmds.h +++ b/src/include/commands/portalcmds.h @@ -4,7 +4,7 @@ * prototypes for portalcmds.c. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/portalcmds.h diff --git a/src/include/commands/prepare.h b/src/include/commands/prepare.h index 222734b7aa..3d7b068047 100644 --- a/src/include/commands/prepare.h +++ b/src/include/commands/prepare.h @@ -4,7 +4,7 @@ * PREPARE, EXECUTE and DEALLOCATE commands, and prepared-stmt storage * * - * Copyright (c) 2002-2012, PostgreSQL Global Development Group + * Copyright (c) 2002-2014, PostgreSQL Global Development Group * * src/include/commands/prepare.h * @@ -14,6 +14,7 @@ #define PREPARE_H #include "commands/explain.h" +#include "datatype/timestamp.h" #include "utils/plancache.h" /* diff --git a/src/include/commands/proclang.h b/src/include/commands/proclang.h index 17d0972419..f43c321ce2 100644 --- a/src/include/commands/proclang.h +++ b/src/include/commands/proclang.h @@ -14,11 +14,8 @@ #include "nodes/parsenodes.h" -extern void CreateProceduralLanguage(CreatePLangStmt *stmt); +extern Oid CreateProceduralLanguage(CreatePLangStmt *stmt); extern void DropProceduralLanguageById(Oid langOid); -extern void RenameLanguage(const char *oldname, const char *newname); -extern void AlterLanguageOwner(const char *name, Oid newOwnerId); -extern void AlterLanguageOwner_oid(Oid oid, Oid newOwnerId); extern bool PLTemplateExists(const char *languageName); extern Oid get_language_oid(const char *langname, bool missing_ok); diff --git a/src/include/commands/schemacmds.h b/src/include/commands/schemacmds.h index cb19598cb5..134e88c712 100644 --- a/src/include/commands/schemacmds.h +++ b/src/include/commands/schemacmds.h @@ -4,7 +4,7 @@ * prototypes for schemacmds.c. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/schemacmds.h @@ -18,16 +18,16 @@ #include "nodes/parsenodes.h" #ifdef PGXC -extern void CreateSchemaCommand(CreateSchemaStmt *parsetree, +extern Oid CreateSchemaCommand(CreateSchemaStmt *parsetree, const char *queryString, bool is_top_level); #else -extern void CreateSchemaCommand(CreateSchemaStmt *parsetree, +extern Oid CreateSchemaCommand(CreateSchemaStmt *parsetree, const char *queryString); #endif extern void RemoveSchemaById(Oid schemaOid); -extern void RenameSchema(const char *oldname, const char *newname); -extern void AlterSchemaOwner(const char *name, Oid newOwnerId); +extern Oid RenameSchema(const char *oldname, const char *newname); +extern Oid AlterSchemaOwner(const char *name, Oid newOwnerId); extern void AlterSchemaOwner_oid(Oid schemaOid, Oid newOwnerId); #endif /* SCHEMACMDS_H */ diff --git a/src/include/commands/seclabel.h b/src/include/commands/seclabel.h index 94b3c39cc1..ad9fce119f 100644 --- a/src/include/commands/seclabel.h +++ b/src/include/commands/seclabel.h @@ -3,7 +3,7 @@ * * Prototypes for functions in commands/seclabel.c * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California */ #ifndef SECLABEL_H @@ -24,7 +24,7 @@ extern void DeleteSharedSecurityLabel(Oid objectId, Oid classId); /* * Statement and ESP hook support */ -extern void ExecSecLabelStmt(SecLabelStmt *stmt); +extern Oid ExecSecLabelStmt(SecLabelStmt *stmt); typedef void (*check_object_relabel_type) (const ObjectAddress *object, const char *seclabel); diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h index a917a06a87..fff8f61264 100644 --- a/src/include/commands/sequence.h +++ b/src/include/commands/sequence.h @@ -8,7 +8,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/sequence.h @@ -81,9 +81,10 @@ extern Datum lastval(PG_FUNCTION_ARGS); extern Datum pg_sequence_parameters(PG_FUNCTION_ARGS); -extern void DefineSequence(CreateSeqStmt *stmt); -extern void AlterSequence(AlterSeqStmt *stmt); +extern Oid DefineSequence(CreateSeqStmt *stmt); +extern Oid AlterSequence(AlterSeqStmt *stmt); extern void ResetSequence(Oid seq_relid); +extern void ResetSequenceCaches(void); extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr); extern void seq_desc(StringInfo buf, uint8 xl_info, char *rec); diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index e262a1d8d3..15f487e757 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -4,7 +4,7 @@ * prototypes for tablecmds.c. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/tablecmds.h @@ -15,6 +15,7 @@ #define TABLECMDS_H #include "access/htup.h" +#include "catalog/dependency.h" #include "nodes/parsenodes.h" #include "storage/lock.h" #include "utils/relcache.h" @@ -34,11 +35,15 @@ extern void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, L extern void AlterTableInternal(Oid relid, List *cmds, bool recurse); -extern void AlterTableNamespace(AlterObjectSchemaStmt *stmt); +extern Oid AlterTableNamespace(AlterObjectSchemaStmt *stmt); + +extern void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, + Oid nspOid, ObjectAddresses *objsMoved); extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, Oid oldNspOid, Oid newNspOid, - bool hasDependEntry); + bool hasDependEntry, + ObjectAddresses *objsMoved); extern void CheckTableNotInUse(Relation rel, const char *stmt); @@ -46,14 +51,14 @@ extern void ExecuteTruncate(TruncateStmt *stmt); extern void SetRelationHasSubclass(Oid relationId, bool relhassubclass); -extern void renameatt(RenameStmt *stmt); +extern Oid renameatt(RenameStmt *stmt); -extern void RenameConstraint(RenameStmt *stmt); +extern Oid RenameConstraint(RenameStmt *stmt); -extern void RenameRelation(RenameStmt *stmt); +extern Oid RenameRelation(RenameStmt *stmt); extern void RenameRelationInternal(Oid myrelid, - const char *newrelname); + const char *newrelname, bool is_internal); extern void find_composite_type_dependencies(Oid typeOid, Relation origRelation, @@ -61,10 +66,6 @@ extern void find_composite_type_dependencies(Oid typeOid, extern void check_of_type(HeapTuple typetuple); -extern AttrNumber *varattnos_map(TupleDesc olddesc, TupleDesc newdesc); -extern AttrNumber *varattnos_map_schema(TupleDesc old, List *schema); -extern void change_varattnos_of_a_node(Node *node, const AttrNumber *newattno); - extern void register_on_commit_action(Oid relid, OnCommitAction action); extern void remove_on_commit_action(Oid relid); @@ -85,4 +86,6 @@ extern void DropTableThrowErrorExternal(RangeVar *relation, extern void RangeVarCallbackOwnsTable(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg); +extern void RangeVarCallbackOwnsRelation(const RangeVar *relation, + Oid relId, Oid oldRelId, void *noCatalogs); #endif /* TABLECMDS_H */ diff --git a/src/include/commands/tablespace.h b/src/include/commands/tablespace.h index fe8b6a5dc2..1603f677a7 100644 --- a/src/include/commands/tablespace.h +++ b/src/include/commands/tablespace.h @@ -4,7 +4,7 @@ * Tablespace management commands (create/drop tablespace). * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/tablespace.h @@ -39,11 +39,11 @@ typedef struct TableSpaceOpts float8 seq_page_cost; } TableSpaceOpts; -extern void CreateTableSpace(CreateTableSpaceStmt *stmt); +extern Oid CreateTableSpace(CreateTableSpaceStmt *stmt); extern void DropTableSpace(DropTableSpaceStmt *stmt); -extern void RenameTableSpace(const char *oldname, const char *newname); -extern void AlterTableSpaceOwner(const char *name, Oid newOwnerId); -extern void AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt); +extern Oid RenameTableSpace(const char *oldname, const char *newname); +extern Oid AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt); +extern Oid AlterTableSpaceMove(AlterTableSpaceMoveStmt *stmt); extern void TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo); diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h index 1f7ba47466..2239a32d52 100644 --- a/src/include/commands/trigger.h +++ b/src/include/commands/trigger.h @@ -3,7 +3,7 @@ * trigger.h * Declarations for trigger handling. * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/trigger.h @@ -109,13 +109,13 @@ extern PGDLLIMPORT int SessionReplicationRole; #define TRIGGER_DISABLED 'D' extern Oid CreateTrigger(CreateTrigStmt *stmt, const char *queryString, - Oid constraintOid, Oid indexOid, + Oid relOid, Oid refRelOid, Oid constraintOid, Oid indexOid, bool isInternal); extern void RemoveTriggerById(Oid trigOid); extern Oid get_trigger_oid(Oid relid, const char *name, bool missing_ok); -extern void renametrig(RenameStmt *stmt); +extern Oid renametrig(RenameStmt *stmt); extern void EnableDisableTrigger(Relation rel, const char *tgname, char fires_when, bool skip_system); @@ -147,10 +147,12 @@ extern void ExecASDeleteTriggers(EState *estate, extern bool ExecBRDeleteTriggers(EState *estate, EPQState *epqstate, ResultRelInfo *relinfo, - ItemPointer tupleid); + ItemPointer tupleid, + HeapTuple fdw_trigtuple); extern void ExecARDeleteTriggers(EState *estate, ResultRelInfo *relinfo, - ItemPointer tupleid); + ItemPointer tupleid, + HeapTuple fdw_trigtuple); extern bool ExecIRDeleteTriggers(EState *estate, ResultRelInfo *relinfo, HeapTuple trigtuple); @@ -162,10 +164,12 @@ extern TupleTableSlot *ExecBRUpdateTriggers(EState *estate, EPQState *epqstate, ResultRelInfo *relinfo, ItemPointer tupleid, + HeapTuple fdw_trigtuple, TupleTableSlot *slot); extern void ExecARUpdateTriggers(EState *estate, ResultRelInfo *relinfo, ItemPointer tupleid, + HeapTuple fdw_trigtuple, HeapTuple newtuple, List *recheckIndexes); extern TupleTableSlot *ExecIRUpdateTriggers(EState *estate, @@ -194,10 +198,10 @@ extern bool AfterTriggerPendingOnRel(Oid relid); /* * in utils/adt/ri_triggers.c */ -extern bool RI_FKey_keyequal_upd_pk(Trigger *trigger, Relation pk_rel, - HeapTuple old_row, HeapTuple new_row); -extern bool RI_FKey_keyequal_upd_fk(Trigger *trigger, Relation fk_rel, - HeapTuple old_row, HeapTuple new_row); +extern bool RI_FKey_pk_upd_check_required(Trigger *trigger, Relation pk_rel, + HeapTuple old_row, HeapTuple new_row); +extern bool RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel, + HeapTuple old_row, HeapTuple new_row); extern bool RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel); diff --git a/src/include/commands/typecmds.h b/src/include/commands/typecmds.h index b72cfc4fd9..792c17838d 100644 --- a/src/include/commands/typecmds.h +++ b/src/include/commands/typecmds.h @@ -4,7 +4,7 @@ * prototypes for typecmds.c. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/typecmds.h @@ -15,39 +15,41 @@ #define TYPECMDS_H #include "access/htup.h" +#include "catalog/dependency.h" #include "nodes/parsenodes.h" #define DEFAULT_TYPDELIM ',' -extern void DefineType(List *names, List *parameters); +extern Oid DefineType(List *names, List *parameters); extern void RemoveTypeById(Oid typeOid); -extern void DefineDomain(CreateDomainStmt *stmt); -extern void DefineEnum(CreateEnumStmt *stmt); -extern void DefineRange(CreateRangeStmt *stmt); -extern void AlterEnum(AlterEnumStmt *stmt); +extern Oid DefineDomain(CreateDomainStmt *stmt); +extern Oid DefineEnum(CreateEnumStmt *stmt); +extern Oid DefineRange(CreateRangeStmt *stmt); +extern Oid AlterEnum(AlterEnumStmt *stmt, bool isTopLevel); extern Oid DefineCompositeType(RangeVar *typevar, List *coldeflist); extern Oid AssignTypeArrayOid(void); -extern void AlterDomainDefault(List *names, Node *defaultRaw); -extern void AlterDomainNotNull(List *names, bool notNull); -extern void AlterDomainAddConstraint(List *names, Node *constr); -extern void AlterDomainValidateConstraint(List *names, char *constrName); -extern void AlterDomainDropConstraint(List *names, const char *constrName, +extern Oid AlterDomainDefault(List *names, Node *defaultRaw); +extern Oid AlterDomainNotNull(List *names, bool notNull); +extern Oid AlterDomainAddConstraint(List *names, Node *constr); +extern Oid AlterDomainValidateConstraint(List *names, char *constrName); +extern Oid AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior behavior, bool missing_ok); extern void checkDomainOwner(HeapTuple tup); extern List *GetDomainConstraints(Oid typeOid); -extern void RenameType(RenameStmt *stmt); -extern void AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype); +extern Oid RenameType(RenameStmt *stmt); +extern Oid AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype); extern void AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId, bool hasDependEntry); -extern void AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype); -extern Oid AlterTypeNamespace_oid(Oid typeOid, Oid nspOid); +extern Oid AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype); +extern Oid AlterTypeNamespace_oid(Oid typeOid, Oid nspOid, ObjectAddresses *objsMoved); extern Oid AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid, bool isImplicitArray, - bool errorOnTableType); + bool errorOnTableType, + ObjectAddresses *objsMoved); #endif /* TYPECMDS_H */ diff --git a/src/include/commands/user.h b/src/include/commands/user.h index 476654abf6..d76685182f 100644 --- a/src/include/commands/user.h +++ b/src/include/commands/user.h @@ -22,13 +22,14 @@ typedef void (*check_password_hook_type) (const char *username, const char *pass extern PGDLLIMPORT check_password_hook_type check_password_hook; -extern void CreateRole(CreateRoleStmt *stmt); -extern void AlterRole(AlterRoleStmt *stmt); -extern void AlterRoleSet(AlterRoleSetStmt *stmt); +extern Oid CreateRole(CreateRoleStmt *stmt); +extern Oid AlterRole(AlterRoleStmt *stmt); +extern Oid AlterRoleSet(AlterRoleSetStmt *stmt); extern void DropRole(DropRoleStmt *stmt); extern void GrantRole(GrantRoleStmt *stmt); -extern void RenameRole(const char *oldname, const char *newname); +extern Oid RenameRole(const char *oldname, const char *newname); extern void DropOwnedObjects(DropOwnedStmt *stmt); extern void ReassignOwnedObjects(ReassignOwnedStmt *stmt); +extern List *roleNamesToIds(List *memberNames); #endif /* USER_H */ diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index 7d16edaac5..fd50719680 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -9,7 +9,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/vacuum.h @@ -30,12 +30,12 @@ /*---------- * ANALYZE builds one of these structs for each attribute (column) that is - * to be analyzed. The struct and subsidiary data are in anl_context, + * to be analyzed. The struct and subsidiary data are in anl_context, * so they live until the end of the ANALYZE operation. * * The type-specific typanalyze function is passed a pointer to this struct * and must return TRUE to continue analysis, FALSE to skip analysis of this - * column. In the TRUE case it must set the compute_stats and minrows fields, + * column. In the TRUE case it must set the compute_stats and minrows fields, * and can optionally set extra_data to pass additional info to compute_stats. * minrows is its request for the minimum number of sample rows to be gathered * (but note this request might not be honored, eg if there are fewer rows @@ -78,7 +78,7 @@ typedef struct VacAttrStats * type-specific typanalyze function. * * Note: do not assume that the data being analyzed has the same datatype - * shown in attr, ie do not trust attr->atttypid, attlen, etc. This is + * shown in attr, ie do not trust attr->atttypid, attlen, etc. This is * because some index opclasses store a different type than the underlying * column/expression. Instead use attrtypid, attrtypmod, and attrtype for * information about the datatype being fed to the typanalyze function. @@ -103,9 +103,9 @@ typedef struct VacAttrStats */ bool stats_valid; float4 stanullfrac; /* fraction of entries that are NULL */ - int4 stawidth; /* average width of column values */ + int32 stawidth; /* average width of column values */ float4 stadistinct; /* # distinct values */ - int2 stakind[STATISTIC_NUM_SLOTS]; + int16 stakind[STATISTIC_NUM_SLOTS]; Oid staop[STATISTIC_NUM_SLOTS]; int numnumbers[STATISTIC_NUM_SLOTS]; float4 *stanumbers[STATISTIC_NUM_SLOTS]; @@ -119,7 +119,7 @@ typedef struct VacAttrStats * elements. It should then overwrite these fields. */ Oid statypid[STATISTIC_NUM_SLOTS]; - int2 statyplen[STATISTIC_NUM_SLOTS]; + int16 statyplen[STATISTIC_NUM_SLOTS]; bool statypbyval[STATISTIC_NUM_SLOTS]; char statypalign[STATISTIC_NUM_SLOTS]; @@ -141,6 +141,8 @@ extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for * PostGIS */ extern int vacuum_freeze_min_age; extern int vacuum_freeze_table_age; +extern int vacuum_multixact_freeze_min_age; +extern int vacuum_multixact_freeze_table_age; /* in commands/vacuum.c */ @@ -158,12 +160,17 @@ extern void vac_update_relstats(Relation relation, double num_tuples, BlockNumber num_all_visible_pages, bool hasindex, - TransactionId frozenxid); -extern void vacuum_set_xid_limits(int freeze_min_age, int freeze_table_age, - bool sharedRel, + TransactionId frozenxid, + MultiXactId minmulti); +extern void vacuum_set_xid_limits(Relation rel, + int freeze_min_age, int freeze_table_age, + int multixact_freeze_min_age, + int multixact_freeze_table_age, TransactionId *oldestXmin, TransactionId *freezeLimit, - TransactionId *freezeTableLimit); + TransactionId *xidFullScanLimit, + MultiXactId *multiXactCutoff, + MultiXactId *mxactFullScanLimit); extern void vac_update_datfrozenxid(void); extern void vacuum_delay_point(void); #ifdef XCP diff --git a/src/include/commands/variable.h b/src/include/commands/variable.h index 14540a7561..e0194e3fd9 100644 --- a/src/include/commands/variable.h +++ b/src/include/commands/variable.h @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/variable.h diff --git a/src/include/commands/view.h b/src/include/commands/view.h index efebf95b7a..a77ccc56f7 100644 --- a/src/include/commands/view.h +++ b/src/include/commands/view.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/commands/view.h @@ -16,6 +16,10 @@ #include "nodes/parsenodes.h" -extern void DefineView(ViewStmt *stmt, const char *queryString); +extern void validateWithCheckOption(char *value); + +extern Oid DefineView(ViewStmt *stmt, const char *queryString); + +extern void StoreViewQuery(Oid viewOid, Query *viewParse, bool replace); #endif /* VIEW_H */ diff --git a/src/include/common/fe_memutils.h b/src/include/common/fe_memutils.h new file mode 100644 index 0000000000..61c1b6fd2d --- /dev/null +++ b/src/include/common/fe_memutils.h @@ -0,0 +1,34 @@ +/* + * fe_memutils.h + * memory management support for frontend code + * + * Copyright (c) 2003-2014, PostgreSQL Global Development Group + * + * src/include/common/fe_memutils.h + */ +#ifndef FE_MEMUTILS_H +#define FE_MEMUTILS_H + +/* "Safe" memory allocation functions --- these exit(1) on failure */ +extern char *pg_strdup(const char *in); +extern void *pg_malloc(size_t size); +extern void *pg_malloc0(size_t size); +extern void *pg_realloc(void *pointer, size_t size); +extern void pg_free(void *pointer); + +/* Equivalent functions, deliberately named the same as backend functions */ +extern char *pstrdup(const char *in); +extern void *palloc(Size size); +extern void *palloc0(Size size); +extern void *repalloc(void *pointer, Size size); +extern void pfree(void *pointer); + +/* sprintf into a palloc'd buffer --- these are in psprintf.c */ +extern char * +psprintf(const char *fmt,...) +__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); +extern size_t +pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) +__attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 0))); + +#endif /* FE_MEMUTILS_H */ diff --git a/src/include/common/relpath.h b/src/include/common/relpath.h new file mode 100644 index 0000000000..bd56d47660 --- /dev/null +++ b/src/include/common/relpath.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------------------- + * + * relpath.h + * Declarations for GetRelationPath() and friends + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/relpath.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELPATH_H +#define RELPATH_H + +/* + * Stuff for fork names. + * + * The physical storage of a relation consists of one or more forks. + * The main fork is always created, but in addition to that there can be + * additional forks for storing various metadata. ForkNumber is used when + * we need to refer to a specific fork in a relation. + */ +typedef enum ForkNumber +{ + InvalidForkNumber = -1, + MAIN_FORKNUM = 0, + FSM_FORKNUM, + VISIBILITYMAP_FORKNUM, + INIT_FORKNUM + + /* + * NOTE: if you add a new fork, change MAX_FORKNUM and possibly + * FORKNAMECHARS below, and update the forkNames array in + * src/common/relpath.c + */ +} ForkNumber; + +#define MAX_FORKNUM INIT_FORKNUM + +#define FORKNAMECHARS 4 /* max chars for a fork name */ + +extern const char *const forkNames[]; + +extern ForkNumber forkname_to_number(const char *forkName); +extern int forkname_chars(const char *str, ForkNumber *fork); + +/* + * Stuff for computing filesystem pathnames for relations. + */ +extern char *GetDatabasePath(Oid dbNode, Oid spcNode); + +extern char *GetRelationPath(Oid dbNode, Oid spcNode, Oid relNode, + int backendId, ForkNumber forkNumber); + +/* + * Wrapper macros for GetRelationPath. Beware of multiple + * evaluation of the RelFileNode or RelFileNodeBackend argument! + */ + +/* First argument is a RelFileNode */ +#define relpathbackend(rnode, backend, forknum) \ + GetRelationPath((rnode).dbNode, (rnode).spcNode, (rnode).relNode, \ + backend, forknum) + +/* First argument is a RelFileNode */ +#define relpathperm(rnode, forknum) \ + relpathbackend(rnode, InvalidBackendId, forknum) + +/* First argument is a RelFileNodeBackend */ +#ifdef XCP +#define relpath(rnode, forknum) \ + relpathbackend((rnode).node, InvalidBackendId, (forknum)) +#else +#define relpath(rnode, forknum) \ + relpathbackend((rnode).node, (rnode).backend, forknum) +#endif + +#endif /* RELPATH_H */ diff --git a/src/include/common/username.h b/src/include/common/username.h new file mode 100644 index 0000000000..115d1ed450 --- /dev/null +++ b/src/include/common/username.h @@ -0,0 +1,15 @@ +/* + * username.h + * lookup effective username + * + * Copyright (c) 2003-2014, PostgreSQL Global Development Group + * + * src/include/common/username.h + */ +#ifndef USERNAME_H +#define USERNAME_H + +extern const char *get_user_name(char **errstr); +extern const char *get_user_name_or_exit(const char *progname); + +#endif /* USERNAME_H */ diff --git a/src/include/datatype/timestamp.h b/src/include/datatype/timestamp.h index 706b4480b3..a33821fa61 100644 --- a/src/include/datatype/timestamp.h +++ b/src/include/datatype/timestamp.h @@ -5,7 +5,7 @@ * * Note: this file must be includable in both frontend and backend contexts. * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/datatype/timestamp.h @@ -83,7 +83,7 @@ typedef struct * DAYS_PER_MONTH is very imprecise. The more accurate value is * 365.2425/12 = 30.436875, or '30 days 10:29:06'. Right now we only * return an integral number of days, but someday perhaps we should - * also return a 'time' value to be used as well. ISO 8601 suggests + * also return a 'time' value to be used as well. ISO 8601 suggests * 30 days. */ #define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */ @@ -109,7 +109,7 @@ typedef struct * We allow numeric timezone offsets up to 15:59:59 either way from Greenwich. * Currently, the record holders for wackiest offsets in actual use are zones * Asia/Manila, at -15:56:00 until 1844, and America/Metlakatla, at +15:13:42 - * until 1867. If we were to reject such values we would fail to dump and + * until 1867. If we were to reject such values we would fail to dump and * restore old timestamptz values with these zone settings. */ #define MAX_TZDISP_HOUR 15 /* maximum allowed hour part */ diff --git a/src/include/executor/execdebug.h b/src/include/executor/execdebug.h index e042a6c867..fc5332c47e 100644 --- a/src/include/executor/execdebug.h +++ b/src/include/executor/execdebug.h @@ -7,7 +7,7 @@ * for debug printouts, because that's more flexible than printf(). * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/execdebug.h diff --git a/src/include/executor/execdesc.h b/src/include/executor/execdesc.h index b6c2400ffd..6937a681da 100644 --- a/src/include/executor/execdesc.h +++ b/src/include/executor/execdesc.h @@ -10,7 +10,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/execdesc.h diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index 29e8edcc55..6fe5fe9941 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -9,7 +9,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Portions Copyright (c) 2012-2014, TransLattice, Inc. - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/executor.h @@ -41,7 +41,7 @@ * REWIND indicates that the plan node should try to efficiently support * rescans without parameter changes. (Nodes must support ExecReScan calls * in any case, but if this flag was not given, they are at liberty to do it - * through complete recalculation. Note that a parameter change forces a + * through complete recalculation. Note that a parameter change forces a * full recalculation in any case.) * * BACKWARD indicates that the plan node must respect the es_direction flag. @@ -56,7 +56,7 @@ * is responsible for there being a trigger context for them to be queued in. * * WITH/WITHOUT_OIDS tell the executor to emit tuples with or without space - * for OIDs, respectively. These are currently used only for CREATE TABLE AS. + * for OIDs, respectively. These are currently used only for CREATE TABLE AS. * If neither is set, the plan may or may not produce tuples including OIDs. */ #define EXEC_FLAG_EXPLAIN_ONLY 0x0001 /* EXPLAIN, no ANALYZE */ @@ -66,9 +66,10 @@ #define EXEC_FLAG_SKIP_TRIGGERS 0x0010 /* skip AfterTrigger calls */ #define EXEC_FLAG_WITH_OIDS 0x0020 /* force OIDs in returned tuples */ #define EXEC_FLAG_WITHOUT_OIDS 0x0040 /* force no OIDs in returned tuples */ +#define EXEC_FLAG_WITH_NO_DATA 0x0080 /* rel scannability doesn't matter */ #ifdef XCP /* distributed executor may never execute the plan on this node */ -#define EXEC_FLAG_SUBPLAN 0x0080 +#define EXEC_FLAG_SUBPLAN 0x0100 #endif @@ -203,10 +204,12 @@ extern ResultRelInfo *ExecGetTriggerResultRel(EState *estate, Oid relid); extern bool ExecContextForcesOids(PlanState *planstate, bool *hasoids); extern void ExecConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate); +extern void ExecWithCheckOptions(ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, EState *estate); extern ExecRowMark *ExecFindRowMark(EState *estate, Index rti); extern ExecAuxRowMark *ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist); extern TupleTableSlot *EvalPlanQual(EState *estate, EPQState *epqstate, - Relation relation, Index rti, + Relation relation, Index rti, int lockmode, ItemPointer tid, TransactionId priorXmax); extern HeapTuple EvalPlanQualFetch(EState *estate, Relation relation, int lockmode, ItemPointer tid, TransactionId priorXmax); @@ -356,7 +359,7 @@ extern void ExecAssignScanTypeFromOuterPlan(ScanState *scanstate); extern bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid); -extern Relation ExecOpenScanRelation(EState *estate, Index scanrelid); +extern Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags); extern void ExecCloseScanRelation(Relation scanrel); extern void ExecOpenIndices(ResultRelInfo *resultRelInfo); diff --git a/src/include/executor/functions.h b/src/include/executor/functions.h index 6201f92622..00f309779c 100644 --- a/src/include/executor/functions.h +++ b/src/include/executor/functions.h @@ -4,7 +4,7 @@ * Declarations for execution of SQL-language functions. * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/functions.h diff --git a/src/include/executor/hashjoin.h b/src/include/executor/hashjoin.h index 8f2dc9d547..3beae403ce 100644 --- a/src/include/executor/hashjoin.h +++ b/src/include/executor/hashjoin.h @@ -4,7 +4,7 @@ * internal structures for hash joins * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/hashjoin.h @@ -41,7 +41,7 @@ * If nbatch > 1 then tuples that don't belong in first batch get saved * into inner-batch temp files. The same statements apply for the * first scan of the outer relation, except we write tuples to outer-batch - * temp files. After finishing the first scan, we do the following for + * temp files. After finishing the first scan, we do the following for * each remaining batch: * 1. Read tuples from inner batch file, load into hash buckets. * 2. Read tuples from outer batch file, match to hash buckets and output. @@ -132,7 +132,7 @@ typedef struct HashJoinTableData /* * These arrays are allocated for the life of the hash join, but only if - * nbatch > 1. A file is opened only when we first write a tuple into it + * nbatch > 1. A file is opened only when we first write a tuple into it * (otherwise its pointer remains NULL). Note that the zero'th array * elements never get used, since we will process rather than dump out any * tuples of batch zero. diff --git a/src/include/executor/instrument.h b/src/include/executor/instrument.h index e6dd03c2d7..8ec1033ca9 100644 --- a/src/include/executor/instrument.h +++ b/src/include/executor/instrument.h @@ -4,7 +4,7 @@ * definitions for run-time statistics collection * * - * Copyright (c) 2001-2012, PostgreSQL Global Development Group + * Copyright (c) 2001-2014, PostgreSQL Global Development Group * * src/include/executor/instrument.h * diff --git a/src/include/executor/nodeAgg.h b/src/include/executor/nodeAgg.h index edf3d6371c..d49b3ede44 100644 --- a/src/include/executor/nodeAgg.h +++ b/src/include/executor/nodeAgg.h @@ -4,7 +4,7 @@ * prototypes for nodeAgg.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeAgg.h diff --git a/src/include/executor/nodeAppend.h b/src/include/executor/nodeAppend.h index b0073759c7..2dc1ea3561 100644 --- a/src/include/executor/nodeAppend.h +++ b/src/include/executor/nodeAppend.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeAppend.h diff --git a/src/include/executor/nodeBitmapAnd.h b/src/include/executor/nodeBitmapAnd.h index 9b810b7d80..12ef85d387 100644 --- a/src/include/executor/nodeBitmapAnd.h +++ b/src/include/executor/nodeBitmapAnd.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeBitmapAnd.h diff --git a/src/include/executor/nodeBitmapHeapscan.h b/src/include/executor/nodeBitmapHeapscan.h index df057a32a7..c37e1a041f 100644 --- a/src/include/executor/nodeBitmapHeapscan.h +++ b/src/include/executor/nodeBitmapHeapscan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeBitmapHeapscan.h diff --git a/src/include/executor/nodeBitmapIndexscan.h b/src/include/executor/nodeBitmapIndexscan.h index 8f0d59ff20..9572f7db41 100644 --- a/src/include/executor/nodeBitmapIndexscan.h +++ b/src/include/executor/nodeBitmapIndexscan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeBitmapIndexscan.h diff --git a/src/include/executor/nodeBitmapOr.h b/src/include/executor/nodeBitmapOr.h index 97eea962f3..605103a698 100644 --- a/src/include/executor/nodeBitmapOr.h +++ b/src/include/executor/nodeBitmapOr.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeBitmapOr.h diff --git a/src/include/executor/nodeCtescan.h b/src/include/executor/nodeCtescan.h index 828e0db4a8..18c4d972e0 100644 --- a/src/include/executor/nodeCtescan.h +++ b/src/include/executor/nodeCtescan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeCtescan.h diff --git a/src/include/executor/nodeForeignscan.h b/src/include/executor/nodeForeignscan.h index 11acc9f77c..52b2f8955a 100644 --- a/src/include/executor/nodeForeignscan.h +++ b/src/include/executor/nodeForeignscan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeForeignscan.h diff --git a/src/include/executor/nodeFunctionscan.h b/src/include/executor/nodeFunctionscan.h index 12d3f95422..a624f4b7ee 100644 --- a/src/include/executor/nodeFunctionscan.h +++ b/src/include/executor/nodeFunctionscan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeFunctionscan.h diff --git a/src/include/executor/nodeGroup.h b/src/include/executor/nodeGroup.h index 1da39854ca..515d251bbe 100644 --- a/src/include/executor/nodeGroup.h +++ b/src/include/executor/nodeGroup.h @@ -4,7 +4,7 @@ * prototypes for nodeGroup.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeGroup.h diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h index b519618f91..75be5bdc33 100644 --- a/src/include/executor/nodeHash.h +++ b/src/include/executor/nodeHash.h @@ -4,7 +4,7 @@ * prototypes for nodeHash.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeHash.h diff --git a/src/include/executor/nodeHashjoin.h b/src/include/executor/nodeHashjoin.h index c4708347df..a2115c2e26 100644 --- a/src/include/executor/nodeHashjoin.h +++ b/src/include/executor/nodeHashjoin.h @@ -4,7 +4,7 @@ * prototypes for nodeHashjoin.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeHashjoin.h diff --git a/src/include/executor/nodeIndexonlyscan.h b/src/include/executor/nodeIndexonlyscan.h index fac033e3fe..f9c902aea9 100644 --- a/src/include/executor/nodeIndexonlyscan.h +++ b/src/include/executor/nodeIndexonlyscan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeIndexonlyscan.h diff --git a/src/include/executor/nodeIndexscan.h b/src/include/executor/nodeIndexscan.h index 4502705c07..7db552cf33 100644 --- a/src/include/executor/nodeIndexscan.h +++ b/src/include/executor/nodeIndexscan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeIndexscan.h diff --git a/src/include/executor/nodeLimit.h b/src/include/executor/nodeLimit.h index be9adc59d4..0168fcbf56 100644 --- a/src/include/executor/nodeLimit.h +++ b/src/include/executor/nodeLimit.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeLimit.h diff --git a/src/include/executor/nodeLockRows.h b/src/include/executor/nodeLockRows.h index 0597e43180..86384774fe 100644 --- a/src/include/executor/nodeLockRows.h +++ b/src/include/executor/nodeLockRows.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeLockRows.h diff --git a/src/include/executor/nodeMaterial.h b/src/include/executor/nodeMaterial.h index a625625f02..e92c9afe08 100644 --- a/src/include/executor/nodeMaterial.h +++ b/src/include/executor/nodeMaterial.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeMaterial.h diff --git a/src/include/executor/nodeMergeAppend.h b/src/include/executor/nodeMergeAppend.h index fb8d1a964e..087928c3fa 100644 --- a/src/include/executor/nodeMergeAppend.h +++ b/src/include/executor/nodeMergeAppend.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeMergeAppend.h diff --git a/src/include/executor/nodeMergejoin.h b/src/include/executor/nodeMergejoin.h index 3db8e06180..cd8a650b61 100644 --- a/src/include/executor/nodeMergejoin.h +++ b/src/include/executor/nodeMergejoin.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeMergejoin.h diff --git a/src/include/executor/nodeModifyTable.h b/src/include/executor/nodeModifyTable.h index 1acf80bef9..fa1c06bd64 100644 --- a/src/include/executor/nodeModifyTable.h +++ b/src/include/executor/nodeModifyTable.h @@ -3,7 +3,7 @@ * nodeModifyTable.h * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeModifyTable.h diff --git a/src/include/executor/nodeNestloop.h b/src/include/executor/nodeNestloop.h index 4d9bde60f1..b2068b0b8b 100644 --- a/src/include/executor/nodeNestloop.h +++ b/src/include/executor/nodeNestloop.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeNestloop.h diff --git a/src/include/executor/nodeRecursiveunion.h b/src/include/executor/nodeRecursiveunion.h index 20840ecc2e..5c8c7602df 100644 --- a/src/include/executor/nodeRecursiveunion.h +++ b/src/include/executor/nodeRecursiveunion.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeRecursiveunion.h diff --git a/src/include/executor/nodeResult.h b/src/include/executor/nodeResult.h index f46c2110f1..6482d168d4 100644 --- a/src/include/executor/nodeResult.h +++ b/src/include/executor/nodeResult.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeResult.h diff --git a/src/include/executor/nodeSeqscan.h b/src/include/executor/nodeSeqscan.h index 4044842ec8..86f99d8384 100644 --- a/src/include/executor/nodeSeqscan.h +++ b/src/include/executor/nodeSeqscan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeSeqscan.h diff --git a/src/include/executor/nodeSetOp.h b/src/include/executor/nodeSetOp.h index 1626a313ec..dfac49f786 100644 --- a/src/include/executor/nodeSetOp.h +++ b/src/include/executor/nodeSetOp.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeSetOp.h diff --git a/src/include/executor/nodeSort.h b/src/include/executor/nodeSort.h index d1abf17c78..401c59fa3f 100644 --- a/src/include/executor/nodeSort.h +++ b/src/include/executor/nodeSort.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeSort.h diff --git a/src/include/executor/nodeSubplan.h b/src/include/executor/nodeSubplan.h index 3ef1e69d03..29ca8c0a78 100644 --- a/src/include/executor/nodeSubplan.h +++ b/src/include/executor/nodeSubplan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeSubplan.h diff --git a/src/include/executor/nodeSubqueryscan.h b/src/include/executor/nodeSubqueryscan.h index b4a6d6ba65..e8cc8ed4af 100644 --- a/src/include/executor/nodeSubqueryscan.h +++ b/src/include/executor/nodeSubqueryscan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeSubqueryscan.h diff --git a/src/include/executor/nodeTidscan.h b/src/include/executor/nodeTidscan.h index 0f9403f453..813aab5d9f 100644 --- a/src/include/executor/nodeTidscan.h +++ b/src/include/executor/nodeTidscan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeTidscan.h diff --git a/src/include/executor/nodeUnique.h b/src/include/executor/nodeUnique.h index 849c71ea80..fe3ca2b553 100644 --- a/src/include/executor/nodeUnique.h +++ b/src/include/executor/nodeUnique.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeUnique.h diff --git a/src/include/executor/nodeValuesscan.h b/src/include/executor/nodeValuesscan.h index 4edf0ea642..4864d1a9ac 100644 --- a/src/include/executor/nodeValuesscan.h +++ b/src/include/executor/nodeValuesscan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeValuesscan.h diff --git a/src/include/executor/nodeWindowAgg.h b/src/include/executor/nodeWindowAgg.h index 7fe3872896..91f4bbc4eb 100644 --- a/src/include/executor/nodeWindowAgg.h +++ b/src/include/executor/nodeWindowAgg.h @@ -4,7 +4,7 @@ * prototypes for nodeWindowAgg.c * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeWindowAgg.h diff --git a/src/include/executor/nodeWorktablescan.h b/src/include/executor/nodeWorktablescan.h index 46e8824259..418ca0cf79 100644 --- a/src/include/executor/nodeWorktablescan.h +++ b/src/include/executor/nodeWorktablescan.h @@ -4,7 +4,7 @@ * * * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/nodeWorktablescan.h diff --git a/src/include/executor/spi.h b/src/include/executor/spi.h index 25676f596f..00cf8012e0 100644 --- a/src/include/executor/spi.h +++ b/src/include/executor/spi.h @@ -3,7 +3,7 @@ * spi.h * Server Programming Interface public declarations * - * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/spi.h @@ -13,6 +13,7 @@ #ifndef SPI_H #define SPI_H +#include "lib/ilist.h" #include "nodes/parsenodes.h" #includ |