Skip to content

Commit

Permalink
Extract sources
Browse files Browse the repository at this point in the history
  • Loading branch information
msepga committed Dec 15, 2023
1 parent 3a64b99 commit 57b73c7
Show file tree
Hide file tree
Showing 578 changed files with 81,460 additions and 59,362 deletions.
6 changes: 3 additions & 3 deletions pg_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ void pg_query_free_fingerprint_result(PgQueryFingerprintResult result);
void pg_query_exit(void);

// Postgres version information
#define PG_MAJORVERSION "15"
#define PG_VERSION "15.1"
#define PG_VERSION_NUM 150001
#define PG_MAJORVERSION "16"
#define PG_VERSION "16.1"
#define PG_VERSION_NUM 160001

// Deprecated APIs below

Expand Down
4 changes: 3 additions & 1 deletion src/postgres/include/access/amapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* amapi.h
* API for Postgres index access methods.
*
* Copyright (c) 2015-2022, PostgreSQL Global Development Group
* Copyright (c) 2015-2023, PostgreSQL Global Development Group
*
* src/include/access/amapi.h
*
Expand Down Expand Up @@ -244,6 +244,8 @@ typedef struct IndexAmRoutine
bool amcaninclude;
/* does AM use maintenance_work_mem? */
bool amusemaintenanceworkmem;
/* does AM store tuple information only at block granularity? */
bool amsummarizing;
/* OR of parallel vacuum flags. See vacuum.h for flags. */
uint8 amparallelvacuumoptions;
/* type of data stored in index, or InvalidOid if variable */
Expand Down
8 changes: 5 additions & 3 deletions src/postgres/include/access/attmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Definitions for PostgreSQL attribute mappings
*
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/attmap.h
Expand Down Expand Up @@ -42,9 +42,11 @@ extern void free_attrmap(AttrMap *map);

/* Conversion routines to build mappings */
extern AttrMap *build_attrmap_by_name(TupleDesc indesc,
TupleDesc outdesc);
TupleDesc outdesc,
bool missing_ok);
extern AttrMap *build_attrmap_by_name_if_req(TupleDesc indesc,
TupleDesc outdesc);
TupleDesc outdesc,
bool missing_ok);
extern AttrMap *build_attrmap_by_position(TupleDesc indesc,
TupleDesc outdesc,
const char *msg);
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/include/access/attnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* POSTGRES attribute number definitions.
*
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/attnum.h
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/include/access/clog.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PostgreSQL transaction-commit-log manager
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/clog.h
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/include/access/commit_ts.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PostgreSQL commit timestamp manager
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/commit_ts.h
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/include/access/detoast.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* detoast.h
* Access to compressed and external varlena values.
*
* Copyright (c) 2000-2022, PostgreSQL Global Development Group
* Copyright (c) 2000-2023, PostgreSQL Global Development Group
*
* src/include/access/detoast.h
*
Expand Down
12 changes: 7 additions & 5 deletions src/postgres/include/access/genam.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* POSTGRES generalized index access method definitions.
*
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/genam.h
Expand Down Expand Up @@ -44,6 +44,7 @@ typedef struct IndexBuildResult
typedef struct IndexVacuumInfo
{
Relation index; /* the index being vacuumed */
Relation heaprel; /* the heap relation the index belongs to */
bool analyze_only; /* ANALYZE (without any actual vacuum) */
bool report_progress; /* emit progress.h status reports */
bool estimated_count; /* num_heap_tuples is an estimate */
Expand Down Expand Up @@ -161,9 +162,10 @@ extern void index_rescan(IndexScanDesc scan,
extern void index_endscan(IndexScanDesc scan);
extern void index_markpos(IndexScanDesc scan);
extern void index_restrpos(IndexScanDesc scan);
extern Size index_parallelscan_estimate(Relation indexrel, Snapshot snapshot);
extern void index_parallelscan_initialize(Relation heaprel, Relation indexrel,
Snapshot snapshot, ParallelIndexScanDesc target);
extern Size index_parallelscan_estimate(Relation indexRelation, Snapshot snapshot);
extern void index_parallelscan_initialize(Relation heapRelation,
Relation indexRelation, Snapshot snapshot,
ParallelIndexScanDesc target);
extern void index_parallelrescan(IndexScanDesc scan);
extern IndexScanDesc index_beginscan_parallel(Relation heaprel,
Relation indexrel, int nkeys, int norderbys,
Expand Down Expand Up @@ -191,7 +193,7 @@ extern void index_store_float8_orderby_distances(IndexScanDesc scan,
Oid *orderByTypes,
IndexOrderByDistance *distances,
bool recheckOrderBy);
extern bytea *index_opclass_options(Relation relation, AttrNumber attnum,
extern bytea *index_opclass_options(Relation indrel, AttrNumber attnum,
Datum attoptions, bool validate);


Expand Down
19 changes: 16 additions & 3 deletions src/postgres/include/access/gin.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* gin.h
* Public header file for Generalized Inverted Index access method.
*
* Copyright (c) 2006-2022, PostgreSQL Global Development Group
* Copyright (c) 2006-2023, PostgreSQL Global Development Group
*
* src/include/access/gin.h
*--------------------------------------------------------------------------
Expand Down Expand Up @@ -57,13 +57,26 @@ typedef struct GinStatsData
*/
typedef char GinTernaryValue;

StaticAssertDecl(sizeof(GinTernaryValue) == sizeof(bool),
"sizes of GinTernaryValue and bool are not equal");

#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))
static inline GinTernaryValue
DatumGetGinTernaryValue(Datum X)
{
return (GinTernaryValue) X;
}

static inline Datum
GinTernaryValueGetDatum(GinTernaryValue X)
{
return (Datum) X;
}

#define PG_RETURN_GIN_TERNARY_VALUE(x) return GinTernaryValueGetDatum(x)

/* GUC parameters */
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/include/access/htup.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* POSTGRES heap tuple definitions.
*
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/htup.h
Expand Down
8 changes: 6 additions & 2 deletions src/postgres/include/access/htup_details.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* POSTGRES heap tuple header definitions.
*
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/htup_details.h
Expand All @@ -19,6 +19,7 @@
#include "access/tupdesc.h"
#include "access/tupmacs.h"
#include "storage/bufpage.h"
#include "varatt.h"

/*
* MaxTupleAttributeNumber limits the number of (user) columns in a tuple.
Expand Down Expand Up @@ -426,6 +427,9 @@ do { \
(tup)->t_choice.t_heap.t_field3.t_xvac = (xid); \
} while (0)

StaticAssertDecl(MaxOffsetNumber < SpecTokenOffsetNumber,
"invalid speculative token constant");

#define HeapTupleHeaderIsSpeculative(tup) \
( \
(ItemPointerGetOffsetNumberNoCheck(&(tup)->t_ctid) == SpecTokenOffsetNumber) \
Expand Down Expand Up @@ -699,7 +703,7 @@ extern void heap_fill_tuple(TupleDesc tupleDesc,
uint16 *infomask, bits8 *bit);
extern bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc);
extern Datum nocachegetattr(HeapTuple tup, int attnum,
TupleDesc att);
TupleDesc tupleDesc);
extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
bool *isnull);
extern Datum getmissingattr(TupleDesc tupleDesc,
Expand Down
119 changes: 61 additions & 58 deletions src/postgres/include/access/itup.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* POSTGRES index tuple definitions.
*
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/itup.h
Expand Down Expand Up @@ -73,21 +73,38 @@ typedef IndexAttributeBitMapData * IndexAttributeBitMap;
#define IndexTupleHasVarwidths(itup) ((((IndexTuple) (itup))->t_info & INDEX_VAR_MASK))


/* routines in indextuple.c */
extern IndexTuple index_form_tuple(TupleDesc tupleDescriptor,
Datum *values, bool *isnull);
extern IndexTuple index_form_tuple_context(TupleDesc tupleDescriptor,
Datum *values, bool *isnull,
MemoryContext context);
extern Datum nocache_index_getattr(IndexTuple tup, int attnum,
TupleDesc tupleDesc);
extern void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor,
Datum *values, bool *isnull);
extern void index_deform_tuple_internal(TupleDesc tupleDescriptor,
Datum *values, bool *isnull,
char *tp, bits8 *bp, int hasnulls);
extern IndexTuple CopyIndexTuple(IndexTuple source);
extern IndexTuple index_truncate_tuple(TupleDesc sourceDescriptor,
IndexTuple source, int leavenatts);


/*
* Takes an infomask as argument (primarily because this needs to be usable
* at index_form_tuple time so enough space is allocated).
*/
#define IndexInfoFindDataOffset(t_info) \
( \
(!((t_info) & INDEX_NULL_MASK)) ? \
( \
(Size)MAXALIGN(sizeof(IndexTupleData)) \
) \
: \
( \
(Size)MAXALIGN(sizeof(IndexTupleData) + sizeof(IndexAttributeBitMapData)) \
) \
)
static inline Size
IndexInfoFindDataOffset(unsigned short t_info)
{
if (!(t_info & INDEX_NULL_MASK))
return MAXALIGN(sizeof(IndexTupleData));
else
return MAXALIGN(sizeof(IndexTupleData) + sizeof(IndexAttributeBitMapData));
}

#ifndef FRONTEND

/* ----------------
* index_getattr
Expand All @@ -97,34 +114,38 @@ typedef IndexAttributeBitMapData * IndexAttributeBitMap;
*
* ----------------
*/
#define index_getattr(tup, attnum, tupleDesc, isnull) \
( \
AssertMacro(PointerIsValid(isnull) && (attnum) > 0), \
*(isnull) = false, \
!IndexTupleHasNulls(tup) ? \
( \
TupleDescAttr((tupleDesc), (attnum)-1)->attcacheoff >= 0 ? \
( \
fetchatt(TupleDescAttr((tupleDesc), (attnum)-1), \
(char *) (tup) + IndexInfoFindDataOffset((tup)->t_info) \
+ TupleDescAttr((tupleDesc), (attnum)-1)->attcacheoff) \
) \
: \
nocache_index_getattr((tup), (attnum), (tupleDesc)) \
) \
: \
( \
(att_isnull((attnum)-1, (char *)(tup) + sizeof(IndexTupleData))) ? \
( \
*(isnull) = true, \
(Datum)NULL \
) \
: \
( \
nocache_index_getattr((tup), (attnum), (tupleDesc)) \
) \
) \
)
static inline Datum
index_getattr(IndexTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
{
Assert(PointerIsValid(isnull));
Assert(attnum > 0);

*isnull = false;

if (!IndexTupleHasNulls(tup))
{
if (TupleDescAttr(tupleDesc, attnum - 1)->attcacheoff >= 0)
{
return fetchatt(TupleDescAttr(tupleDesc, attnum - 1),
(char *) tup + IndexInfoFindDataOffset(tup->t_info)
+ TupleDescAttr(tupleDesc, attnum - 1)->attcacheoff);
}
else
return nocache_index_getattr(tup, attnum, tupleDesc);
}
else
{
if (att_isnull(attnum - 1, (bits8 *) tup + sizeof(IndexTupleData)))
{
*isnull = true;
return (Datum) NULL;
}
else
return nocache_index_getattr(tup, attnum, tupleDesc);
}
}

#endif

/*
* MaxIndexTuplesPerPage is an upper bound on the number of tuples that can
Expand All @@ -146,22 +167,4 @@ typedef IndexAttributeBitMapData * IndexAttributeBitMap;
((int) ((BLCKSZ - SizeOfPageHeaderData) / \
(MAXALIGN(sizeof(IndexTupleData) + 1) + sizeof(ItemIdData))))


/* routines in indextuple.c */
extern IndexTuple index_form_tuple(TupleDesc tupleDescriptor,
Datum *values, bool *isnull);
extern IndexTuple index_form_tuple_context(TupleDesc tupleDescriptor,
Datum *values, bool *isnull,
MemoryContext context);
extern Datum nocache_index_getattr(IndexTuple tup, int attnum,
TupleDesc tupleDesc);
extern void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor,
Datum *values, bool *isnull);
extern void index_deform_tuple_internal(TupleDesc tupleDescriptor,
Datum *values, bool *isnull,
char *tp, bits8 *bp, int hasnulls);
extern IndexTuple CopyIndexTuple(IndexTuple source);
extern IndexTuple index_truncate_tuple(TupleDesc sourceDescriptor,
IndexTuple source, int leavenatts);

#endif /* ITUP_H */
4 changes: 2 additions & 2 deletions src/postgres/include/access/parallel.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* parallel.h
* Infrastructure for launching parallel workers
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/parallel.h
Expand Down Expand Up @@ -54,7 +54,7 @@ typedef struct ParallelWorkerContext
shm_toc *toc;
} ParallelWorkerContext;

extern PGDLLIMPORT volatile bool ParallelMessagePending;
extern PGDLLIMPORT volatile sig_atomic_t ParallelMessagePending;
extern PGDLLIMPORT int ParallelWorkerNumber;
extern PGDLLIMPORT bool InitializingParallelWorker;

Expand Down
2 changes: 1 addition & 1 deletion src/postgres/include/access/printtup.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
*
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/printtup.h
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/include/access/relation.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Generic relation related routines.
*
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/access/relation.h
Expand Down
Loading

0 comments on commit 57b73c7

Please sign in to comment.