Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Postgres95 1.01 Distribution - Virgin Sources

  • Loading branch information...
commit d31084e9d1118b25fd16580d9d8c2924b5740dff 0 parents
Marc G. Fournier scrappy authored

Showing 869 changed files with 33,129 additions and 0 deletions. Show diff stats Hide diff stats

  1. +48 0 src/Makefile
  2. +306 0 src/Makefile.global
  3. +289 0 src/backend/Makefile
  4. +35 0 src/backend/access/Makefile.inc
  5. +61 0 src/backend/access/attnum.h
  6. +16 0 src/backend/access/common/Makefile.inc
  7. +1,011 0 src/backend/access/common/heaptuple.c
  8. +134 0 src/backend/access/common/heapvalid.c
  9. +427 0 src/backend/access/common/indextuple.c
  10. +84 0 src/backend/access/common/indexvalid.c
  11. +306 0 src/backend/access/common/printtup.c
  12. +68 0 src/backend/access/common/scankey.c
  13. +398 0 src/backend/access/common/tupdesc.c
  14. +43 0 src/backend/access/funcindex.h
  15. +60 0 src/backend/access/genam.h
  16. +336 0 src/backend/access/hash.h
  17. +18 0 src/backend/access/hash/Makefile.inc
  18. +467 0 src/backend/access/hash/hash.c
  19. +276 0 src/backend/access/hash/hashfunc.c
  20. +239 0 src/backend/access/hash/hashinsert.c
  21. +614 0 src/backend/access/hash/hashovfl.c
  22. +669 0 src/backend/access/hash/hashpage.c
  23. +172 0 src/backend/access/hash/hashscan.c
  24. +425 0 src/backend/access/hash/hashsearch.c
  25. +104 0 src/backend/access/hash/hashstrat.c
  26. +147 0 src/backend/access/hash/hashutil.c
  27. +14 0 src/backend/access/heap/Makefile.inc
  28. +1,507 0 src/backend/access/heap/heapam.c
  29. +195 0 src/backend/access/heap/hio.c
  30. +329 0 src/backend/access/heap/stats.c
  31. +149 0 src/backend/access/heapam.h
  32. +26 0 src/backend/access/hio.h
  33. +115 0 src/backend/access/htup.h
  34. +34 0 src/backend/access/ibit.h
  35. +14 0 src/backend/access/index/Makefile.inc
  36. +275 0 src/backend/access/index/genam.c
  37. +411 0 src/backend/access/index/indexam.c
  38. +679 0 src/backend/access/index/istrat.c
  39. +32 0 src/backend/access/iqual.h
  40. +80 0 src/backend/access/istrat.h
  41. +104 0 src/backend/access/itup.h
  42. +264 0 src/backend/access/nbtree.h
  43. +15 0 src/backend/access/nbtree/Makefile.inc
  44. +68 0 src/backend/access/nbtree/README
  45. +173 0 src/backend/access/nbtree/nbtcompare.c
  46. +831 0 src/backend/access/nbtree/nbtinsert.c
  47. +523 0 src/backend/access/nbtree/nbtpage.c
  48. +516 0 src/backend/access/nbtree/nbtree.c
  49. +164 0 src/backend/access/nbtree/nbtscan.c
  50. +1,133 0 src/backend/access/nbtree/nbtsearch.c
  51. +1,196 0 src/backend/access/nbtree/nbtsort.c
  52. +134 0 src/backend/access/nbtree/nbtstrat.c
  53. +239 0 src/backend/access/nbtree/nbtutils.c
  54. +26 0 src/backend/access/printtup.h
  55. +87 0 src/backend/access/relscan.h
  56. +98 0 src/backend/access/rtree.h
  57. +14 0 src/backend/access/rtree/Makefile.inc
  58. +320 0 src/backend/access/rtree/rtget.c
  59. +150 0 src/backend/access/rtree/rtproc.c
  60. +955 0 src/backend/access/rtree/rtree.c
  61. +392 0 src/backend/access/rtree/rtscan.c
  62. +239 0 src/backend/access/rtree/rtstrat.c
  63. +17 0 src/backend/access/rtscan.h
  64. +18 0 src/backend/access/rtstrat.h
  65. +57 0 src/backend/access/sdir.h
  66. +52 0 src/backend/access/skey.h
  67. +86 0 src/backend/access/strat.h
  68. +213 0 src/backend/access/transam.h
  69. +14 0 src/backend/access/transam/Makefile.inc
  70. +675 0 src/backend/access/transam/transam.c
  71. +663 0 src/backend/access/transam/transsup.c
  72. +606 0 src/backend/access/transam/varsup.c
  73. +1,314 0 src/backend/access/transam/xact.c
  74. +156 0 src/backend/access/transam/xid.c
  75. +53 0 src/backend/access/tupdesc.h
  76. +43 0 src/backend/access/tupmacs.h
  77. +37 0 src/backend/access/valid.h
  78. +115 0 src/backend/access/xact.h
  79. +63 0 src/backend/bootstrap/Makefile.inc
  80. +9 0 src/backend/bootstrap/boot.sed
  81. +293 0 src/backend/bootstrap/bootparse.y
  82. +108 0 src/backend/bootstrap/bootscanner.l
  83. +1,049 0 src/backend/bootstrap/bootstrap.c
  84. +78 0 src/backend/bootstrap/bootstrap.h
  85. +69 0 src/backend/catalog/Makefile.inc
  86. +66 0 src/backend/catalog/README
  87. +205 0 src/backend/catalog/catalog.c
  88. +24 0 src/backend/catalog/catalog.h
  89. +52 0 src/backend/catalog/catname.h
  90. +218 0 src/backend/catalog/genbki.sh
  91. +1,428 0 src/backend/catalog/heap.c
  92. +42 0 src/backend/catalog/heap.h
  93. +1,655 0 src/backend/catalog/index.c
  94. +59 0 src/backend/catalog/index.h
  95. +561 0 src/backend/catalog/indexing.c
  96. +103 0 src/backend/catalog/indexing.h
  97. +325 0 src/backend/catalog/pg_aggregate.c
  98. +132 0 src/backend/catalog/pg_aggregate.h
  99. +115 0 src/backend/catalog/pg_am.h
  100. +546 0 src/backend/catalog/pg_amop.h
  101. +134 0 src/backend/catalog/pg_amproc.h
  102. +512 0 src/backend/catalog/pg_attribute.h
  103. +162 0 src/backend/catalog/pg_class.h
  104. +57 0 src/backend/catalog/pg_database.h
  105. +55 0 src/backend/catalog/pg_defaults.h
  106. +58 0 src/backend/catalog/pg_demon.h
  107. +42 0 src/backend/catalog/pg_group.h
  108. +44 0 src/backend/catalog/pg_hosts.h
  109. +71 0 src/backend/catalog/pg_index.h
  110. +59 0 src/backend/catalog/pg_inheritproc.h
  111. +57 0 src/backend/catalog/pg_inherits.h
  112. +57 0 src/backend/catalog/pg_ipl.h
  113. +75 0 src/backend/catalog/pg_language.h
  114. +56 0 src/backend/catalog/pg_listener.h
  115. +40 0 src/backend/catalog/pg_log.h
  116. +54 0 src/backend/catalog/pg_magic.h
  117. +85 0 src/backend/catalog/pg_opclass.h
  118. +1,077 0 src/backend/catalog/pg_operator.c
  119. +480 0 src/backend/catalog/pg_operator.h
  120. +116 0 src/backend/catalog/pg_parg.h
  121. +265 0 src/backend/catalog/pg_proc.c
Sorry, we could not display the entire diff because too many files (869) changed.
48 src/Makefile
... ... @@ -0,0 +1,48 @@
  1 +#-------------------------------------------------------------------------
  2 +#
  3 +# Makefile.inc--
  4 +# Build and install postgres.
  5 +#
  6 +# Copyright (c) 1994, Regents of the University of California
  7 +#
  8 +#
  9 +# IDENTIFICATION
  10 +# $Header: /cvsroot/pgsql/src/Makefile,v 1.1.1.1 1996/07/09 06:21:07 scrappy Exp $
  11 +#
  12 +# NOTES
  13 +# objdir - location of the objects and generated files (eg. obj)
  14 +#
  15 +#-------------------------------------------------------------------------
  16 +
  17 +SUBDIR= backend libpq bin
  18 +
  19 +FIND = find
  20 +# assuming gnu tar and split here
  21 +TAR = tar
  22 +SPLIT = split
  23 +
  24 +ETAGS = etags
  25 +XARGS = xargs
  26 +
  27 +ifeq ($(USE_TCL), true)
  28 +SUBDIR += libpgtcl
  29 +endif
  30 +
  31 +include mk/postgres.subdir.mk
  32 +
  33 +TAGS:
  34 + rm -f TAGS; \
  35 + for i in backend libpq bin; do \
  36 + $(FIND) $$i -name '*.[chyl]' -print | $(XARGS) $(ETAGS) -a ; \
  37 + done
  38 +
  39 +# target to generate a backup tar file and split files that can be
  40 +# saved to 1.44M floppy
  41 +BACKUP:
  42 + rm -f BACKUP.filelist BACKUP.tgz; \
  43 + $(FIND) . -not -path '*obj/*' -not -path '*data/*' -type f -print > BACKUP.filelist; \
  44 + $(TAR) --files-from BACKUP.filelist -c -z -v -f BACKUP.tgz
  45 + $(SPLIT) --bytes=1400k BACKUP.tgz pgBACKUP.
  46 +
  47 +.PHONY: TAGS
  48 +.PHONY: BACKUP
306 src/Makefile.global
... ... @@ -0,0 +1,306 @@
  1 +#-------------------------------------------------------------------------
  2 +#
  3 +# Makefile.global--
  4 +# global configuration for the Makefiles
  5 +#
  6 +# Copyright (c) 1994, Regents of the University of California
  7 +#
  8 +#
  9 +# IDENTIFICATION
  10 +# $Header: /cvsroot/pgsql/src/Attic/Makefile.global,v 1.1.1.1 1996/07/09 06:21:07 scrappy Exp $
  11 +#
  12 +# NOTES
  13 +# This is seen by any Makefiles that include mk/postgres.mk. To
  14 +# override the default setting, create a Makefile.custom in this
  15 +# directory and put your defines there. (Makefile.custom is included
  16 +# at the end of this file.)
  17 +#
  18 +# If you change any of these defines you probably have to
  19 +# gmake clean; gmake
  20 +# since no dependecies are created for these. (of course you can
  21 +# be crafty and check what files really depend on them and just remake
  22 +# those).
  23 +#
  24 +#-------------------------------------------------------------------------
  25 +
  26 +
  27 +##############################################################################
  28 +#
  29 +# CONFIGURATION SECTION
  30 +#
  31 +# Following are settings pertaining to the postgres build and
  32 +# installation. The most important one is obviously the name
  33 +# of the port.
  34 +
  35 +# The name of the port. Valid choices are:
  36 +# alpha - DEC Alpha AXP on OSF/1 2.0
  37 +# hpux - HP PA-RISC on HP-UX 9.0
  38 +# sparc_solaris - SUN SPARC on Solaris 2.4
  39 +# sparc - SUN SPARC on SunOS 4.1.3
  40 +# ultrix4 - DEC MIPS on Ultrix 4.4
  41 +# linux - Intel x86 on Linux 1.2 and Linux ELF
  42 +# (For non-ELF Linux, you need to comment out
  43 +# "LINUX_ELF=1" in src/mk/port/postgres.mk.linux)
  44 +# BSD44_derived - OSs derived from 4.4-lite BSD (NetBSD, FreeBSD)
  45 +# bsdi - BSD/OS 2.0 and 2.01
  46 +# aix - IBM on AIX 3.2.5
  47 +# irix5 - SGI MIPS on IRIX 5.3
  48 +# Some hooks are provided for
  49 +# svr4 - Intel x86 on Intel SVR4
  50 +# next - Motorola MC68K or Intel x86 on NeXTSTEP 3.2
  51 +# but these are guaranteed not to work as of yet.
  52 +#
  53 +# XXX Note that you MUST set PORTNAME here (or on the command line) so
  54 +# that port-dependent variables are correctly set within this file.
  55 +# Makefile.custom does not take effect (for ifeq purposes)
  56 +# until after this file is processed!
  57 +# make sure that you have no whitespaces after the PORTNAME setting
  58 +# or the makefiles can get confused
  59 +PORTNAME= alpha
  60 +
  61 +# POSTGRESLOGIN is the login name of the user who gets special
  62 +# privileges within the database. By default it is "postgres", but
  63 +# you can change it to any existing login name (such as your own
  64 +# login if you are compiling a private version or don't have root
  65 +# access).
  66 +POSTGRESLOGIN= postgres
  67 +
  68 +# For convenience, POSTGRESDIR is where DATADIR, BINDIR, and LIBDIR
  69 +# and other target destinations are rooted. Of course, each of these is
  70 +# changable separately.
  71 +POSTGRESDIR= /private/postgres95
  72 +
  73 +# SRCDIR specifies where the source files are.
  74 +SRCDIR= $(POSTGRESDIR)/src
  75 +
  76 +# DATADIR specifies where the postmaster expects to find its database.
  77 +# This may be overridden by command line options or the PGDATA environment
  78 +# variable.
  79 +DATADIR= $(POSTGRESDIR)/data
  80 +
  81 +# Where the postgres executables live (changeable by just putting them
  82 +# somewhere else and putting that directory in your shell PATH)
  83 +BINDIR= $(POSTGRESDIR)/bin
  84 +
  85 +# Where libpq.a gets installed. You must put it where your loader will
  86 +# look for it if you wish to use the -lpq convention. Otherwise you
  87 +# can just put the absolute pathname to the library at the end of your
  88 +# command line.
  89 +LIBDIR= $(POSTGRESDIR)/lib
  90 +
  91 +# This is the directory where IPC utilities ipcs and ipcrm are located
  92 +#
  93 +IPCSDIR= /usr/bin
  94 +
  95 +# Where the man pages (suitable for use with "man") get installed.
  96 +POSTMANDIR= $(POSTGRESDIR)/man
  97 +
  98 +# Where the formatted documents (e.g., the reference manual) get installed.
  99 +POSTDOCDIR= $(POSTGRESDIR)/doc
  100 +
  101 +# Where the header files necessary to build frontend programs get installed.
  102 +HEADERDIR= $(POSTGRESDIR)/include
  103 +
  104 +# NAMEDATALEN is the max length for system identifiers (e.g. table names,
  105 +# attribute names, function names, etc.)
  106 +#
  107 +# These MUST be set here. DO NOT COMMENT THESE OUT
  108 +# Setting these too high will result in excess space usage for system catalogs
  109 +# Setting them too low will make the system unusable.
  110 +# values between 16 and 64 that are multiples of four are recommended.
  111 +#
  112 +# NOTE also that databases with different NAMEDATALEN's cannot interoperate!
  113 +#
  114 +NAMEDATALEN = 32
  115 +# OIDNAMELEN should be set to NAMEDATALEN + sizeof(Oid)
  116 +OIDNAMELEN = 36
  117 +
  118 +CFLAGS+= -DNAMEDATALEN=$(NAMEDATALEN) -DOIDNAMELEN=$(OIDNAMELEN)
  119 +
  120 +##############################################################################
  121 +#
  122 +# FEATURES
  123 +#
  124 +# To disable a feature, comment out the entire definition
  125 +# (that is, prepend '#', don't set it to "0" or "no").
  126 +
  127 +# Comment out ENFORCE_ALIGNMENT if you do NOT want unaligned access to
  128 +# multi-byte types to generate a bus error.
  129 +ENFORCE_ALIGNMENT= true
  130 +
  131 +# Comment out CDEBUG to turn off debugging and sanity-checking.
  132 +#
  133 +# XXX on MIPS, use -g3 if you want to compile with -O
  134 +CDEBUG= -g
  135 +
  136 +# turn this on if you prefer European style dates instead of American
  137 +# style dates
  138 +# EUROPEAN_DATES = 1
  139 +
  140 +# Comment out PROFILE to disable profiling.
  141 +#
  142 +# XXX define on MIPS if you want to be able to use pixie.
  143 +# note that this disables dynamic loading!
  144 +#PROFILE= -p -non_shared
  145 +
  146 +# About the use of readline in psql:
  147 +# psql does not require the GNU readline and history libraries. Hence, we
  148 +# do not compile with them by default. However, there are hooks in the
  149 +# program which supports the use of GNU readline and history. Should you
  150 +# decide to use them, change USE_READLINE to true and change READLINE_INCDIR
  151 +# and READLINE_LIBDIR to reflect the location of the readline and histroy
  152 +# headers and libraries.
  153 +#
  154 +#USE_READLINE= true
  155 +
  156 +# directories for the readline and history libraries.
  157 +READLINE_INCDIR= /usr/local/include
  158 +HISTORY_INCDIR= /usr/local/include
  159 +READLINE_LIBDIR= /usr/local/lib
  160 +HISTORY_LIBDIR= /usr/local/lib
  161 +
  162 +# If you do not plan to use Host based authentication,
  163 +# comment out the following line
  164 +HBA = 1
  165 +
  166 +ifdef HBA
  167 +HBAFLAGS= -DHBA
  168 +endif
  169 +
  170 +
  171 +
  172 +# If you plan to use Kerberos for authentication...
  173 +#
  174 +# Comment out KRBVERS if you do not use Kerberos.
  175 +# Set KRBVERS to "4" for Kerberos v4, "5" for Kerberos v5.
  176 +# XXX Edit the default Kerberos variables below!
  177 +#
  178 +#KRBVERS= 5
  179 +
  180 +
  181 +# Globally pass Kerberos file locations.
  182 +# these are used in the postmaster and all libpq applications.
  183 +#
  184 +# Adjust KRBINCS and KRBLIBS to reflect where you have Kerberos
  185 +# include files and libraries installed.
  186 +# PG_KRB_SRVNAM is the name under which POSTGRES is registered in
  187 +# the Kerberos database (KDC).
  188 +# PG_KRB_SRVTAB is the location of the server's keytab file.
  189 +#
  190 +ifdef KRBVERS
  191 +KRBINCS= -I/usr/athena/include
  192 +KRBLIBS= -L/usr/athena/lib
  193 +KRBFLAGS+= $(KRBINCS) -DPG_KRB_SRVNAM='"postgres_dbms"'
  194 + ifeq ($(KRBVERS), 4)
  195 +KRBFLAGS+= -DKRB4
  196 +KRBFLAGS+= -DPG_KRB_SRVTAB='"/etc/srvtab"'
  197 +KRBLIBS+= -lkrb -ldes
  198 + else
  199 + ifeq ($(KRBVERS), 5)
  200 +KRBFLAGS+= -DKRB5
  201 +KRBFLAGS+= -DPG_KRB_SRVTAB='"FILE:/krb5/srvtab.postgres"'
  202 +KRBLIBS+= -lkrb5 -lcrypto -lcom_err -lisode
  203 + endif
  204 + endif
  205 +endif
  206 +
  207 +#
  208 +# location of Tcl/Tk headers and libraries
  209 +#
  210 +# Uncomment this to build the tcl utilities.
  211 +USE_TCL= true
  212 +# customize these to your site's needs
  213 +#
  214 +TCL_INCDIR= /usr/local/devel/tcl7.4/include
  215 +TCL_LIBDIR= /usr/local/devel/tcl7.4/lib
  216 +TCL_LIB = -ltcl7.4
  217 +TK_INCDIR= /usr/local/devel/tk4.0/include
  218 +TK_LIBDIR= /usr/local/devel/tk4.0/lib
  219 +TK_LIB = -ltk4.0
  220 +
  221 +#
  222 +# include port specific rules and variables. For instance:
  223 +#
  224 +# signal(2) handling - this is here because it affects some of
  225 +# the frontend commands as well as the backend server.
  226 +#
  227 +# Ultrix and SunOS provide BSD signal(2) semantics by default.
  228 +#
  229 +# SVID2 and POSIX signal(2) semantics differ from BSD signal(2)
  230 +# semantics. We can use the POSIX sigaction(2) on systems that
  231 +# allow us to request restartable signals (SA_RESTART).
  232 +#
  233 +# Some systems don't allow restartable signals at all unless we
  234 +# link to a special BSD library.
  235 +#
  236 +# We devoutly hope that there aren't any systems that provide
  237 +# neither POSIX signals nor BSD signals. The alternative
  238 +# is to do signal-handler reinstallation, which doesn't work well
  239 +# at all.
  240 +#
  241 +-include $(MKDIR)/port/postgres.mk.$(PORTNAME)
  242 +
  243 +##############################################################################
  244 +#
  245 +# Flags for CC and LD. (depend on CDEBUG and PROFILE)
  246 +#
  247 +
  248 +# Globally pass debugging/optimization/profiling flags based
  249 +# on the options selected above.
  250 +ifdef CDEBUG
  251 + CFLAGS+= $(CDEBUG)
  252 + LDFLAGS+= $(CDEBUG)
  253 +else
  254 + ifndef CFLAGS_OPT
  255 + CFLAGS_OPT= -O
  256 + endif
  257 + CFLAGS+= $(CFLAGS_OPT)
  258 +#
  259 +# Uncommenting this will make things go a LOT faster, but you will
  260 +# also lose a lot of useful error-checking.
  261 +#
  262 + CFLAGS+= -DNO_ASSERT_CHECKING
  263 +endif
  264 +
  265 +ifdef PROFILE
  266 +CFLAGS+= $(PROFILE)
  267 +LDFLAGS+= $(PROFILE)
  268 +endif
  269 +
  270 +# Globally pass PORTNAME
  271 +CFLAGS+= -DPORTNAME_$(PORTNAME)
  272 +
  273 +# Globally pass the default TCP port for postmaster(1).
  274 +CFLAGS+= -DPOSTPORT='"5432"'
  275 +
  276 +# include flags from mk/port/postgres.mk.$(PORTNAME)
  277 +CFLAGS+= $(CFLAGS_BE)
  278 +LDADD+= $(LDADD_BE)
  279 +LDFLAGS+= $(LDFLAGS_BE)
  280 +
  281 +
  282 +##############################################################################
  283 +#
  284 +# Miscellaneous configuration
  285 +#
  286 +
  287 +# This is the time, in seconds, at which a given backend server
  288 +# will wait on a lock before deciding to abort the transaction
  289 +# (this is what we do in lieu of deadlock detection).
  290 +#
  291 +# Low numbers are not recommended as they will tend to cause
  292 +# false aborts if many transactions are long-lived.
  293 +CFLAGS+= -DDEADLOCK_TIMEOUT=60
  294 +
  295 +srcdir= $(SRCDIR)
  296 +includedir= $(HEADERDIR)
  297 +objdir= obj
  298 +
  299 +
  300 +##############################################################################
  301 +#
  302 +# Customization.
  303 +#
  304 +-include $(MKDIR)/../Makefile.custom
  305 +
  306 +
289 src/backend/Makefile
... ... @@ -0,0 +1,289 @@
  1 +#-------------------------------------------------------------------------
  2 +#
  3 +# Makefile--
  4 +# Makefile for the postgres backend (and the postmaster)
  5 +#
  6 +# Copyright (c) 1994, Regents of the University of California
  7 +#
  8 +#
  9 +# IDENTIFICATION
  10 +# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.1.1.1 1996/07/09 06:21:08 scrappy Exp $
  11 +#
  12 +#-------------------------------------------------------------------------
  13 +
  14 +#
  15 +# The following turns on intermediate linking of partial objects to speed
  16 +# the link cycle during development. (To turn this off, put "BIGOBJS=false"
  17 +# in your custom makefile, ../Makefile.custom.)
  18 +BIGOBJS= true
  19 +
  20 +
  21 +PROG= postgres
  22 +
  23 +MKDIR= ../mk
  24 +include $(MKDIR)/postgres.mk
  25 +
  26 +
  27 +include $(CURDIR)/access/Makefile.inc
  28 +include $(CURDIR)/bootstrap/Makefile.inc
  29 +include $(CURDIR)/catalog/Makefile.inc
  30 +include $(CURDIR)/commands/Makefile.inc
  31 +include $(CURDIR)/executor/Makefile.inc
  32 +include $(CURDIR)/include/Makefile.inc
  33 +include $(CURDIR)/lib/Makefile.inc
  34 +include $(CURDIR)/libpq/Makefile.inc
  35 +include $(CURDIR)/main/Makefile.inc
  36 +include $(CURDIR)/nodes/Makefile.inc
  37 +include $(CURDIR)/optimizer/Makefile.inc
  38 +include $(CURDIR)/parser/Makefile.inc
  39 +include $(CURDIR)/port/Makefile.inc
  40 +include $(CURDIR)/postmaster/Makefile.inc
  41 +include $(CURDIR)/regex/Makefile.inc
  42 +include $(CURDIR)/rewrite/Makefile.inc
  43 +include $(CURDIR)/storage/Makefile.inc
  44 +include $(CURDIR)/tcop/Makefile.inc
  45 +include $(CURDIR)/tioga/Makefile.inc
  46 +include $(CURDIR)/utils/Makefile.inc
  47 +
  48 +SRCS:= ${SRCS_ACCESS} ${SRCS_BOOTSTRAP} $(SRCS_CATALOG) ${SRCS_COMMANDS} \
  49 + ${SRCS_EXECUTOR} $(SRCS_LIB) $(SRCS_LIBPQ) ${SRCS_MAIN} \
  50 + ${SRCS_NODES} ${SRCS_OPTIMIZER} ${SRCS_PARSER} ${SRCS_PORT} \
  51 + $(SRCS_POSTMASTER) ${SRCS_REGEX} ${SRCS_REWRITE} ${SRCS_STORAGE} \
  52 + ${SRCS_TCOP} ${SRCS_UTILS}
  53 +
  54 +ifeq ($(BIGOBJS), true)
  55 +OBJS= ACCESS.o BOOTSTRAP.o COMMANDS.o EXECUTOR.o MAIN.o MISC.o NODES.o \
  56 + PARSER.o OPTIMIZER.o REGEX.o REWRITE.o STORAGE.o TCOP.o UTILS.o
  57 +CLEANFILES+= $(subst .s,.o,$(SRCS:.c=.o)) $(OBJS)
  58 +else
  59 +OBJS:= $(subst .s,.o,$(SRCS:%.c=$(objdir)/%.o))
  60 +CLEANFILES+= $(notdir $(OBJS))
  61 +endif
  62 +
  63 +#############################################################################
  64 +#
  65 +# TIOGA stuff
  66 +#
  67 +ifdef TIOGA
  68 +SRCS+= $(SRCS_TIOGA)
  69 + ifeq ($(BIGOBJS), true)
  70 +TIOGA.o: $(SRCS_TIOGA:%.c=$(objdir)/%.o)
  71 + $(make_partial)
  72 +OBJS+= TIOGA.o
  73 +CLEANFILES+= $(SRCS_TIOGA:%.c=%.o) TIOGA.o
  74 + else
  75 +OBJS+= $(SRCS_TIOGA:%.c=$(objdir)/%.o)
  76 + endif
  77 +endif
  78 +
  79 +
  80 +#############################################################################
  81 +#
  82 +# Compiling the postgres backend.
  83 +#
  84 +CFLAGS+= -DPOSTGRESDIR='"$(POSTGRESDIR)"' \
  85 + -DPGDATADIR='"$(DATADIR)"' \
  86 + -I$(CURDIR)/. -I$(CURDIR)/$(objdir) \
  87 + -I$(CURDIR)/include \
  88 + -I$(CURDIR)/port/$(PORTNAME)
  89 +
  90 +# turn this on if you prefer European style dates instead of American
  91 +# style dates
  92 +ifdef EUROPEAN_DATES
  93 +CFLAGS += -DEUROPEAN_STYLE
  94 +endif
  95 +
  96 +# kerberos flags
  97 +ifdef KRBVERS
  98 +CFLAGS+= $(KRBFLAGS)
  99 +LDADD+= $(KRBLIBS)
  100 +endif
  101 +
  102 +# host based access flags
  103 +ifdef HBA
  104 +CFLAGS+= $(HBAFLAGS)
  105 +endif
  106 +
  107 +
  108 +
  109 +#
  110 +# All systems except NEXTSTEP require the math library.
  111 +# Loader flags for system-dependent libraries are appended in
  112 +# src/backend/port/$(PORTNAME)/Makefile.inc
  113 +#
  114 +ifneq ($(PORTNAME), next)
  115 +LDADD+= -lm
  116 +endif
  117 +
  118 +# statically link in libc for linux
  119 +ifeq ($(PORTNAME), linux)
  120 +LDADD+= -lc
  121 +endif
  122 +
  123 +postgres: $(POSTGRES_DEPEND) $(OBJS) $(EXPORTS)
  124 + $(CC) $(LDFLAGS) -o $(objdir)/$(@F) $(addprefix $(objdir)/,$(notdir $(OBJS))) $(LDADD)
  125 +
  126 +# Make this target first if you are doing a parallel make.
  127 +# The targets in 'first' need to be made sequentially because of dependencies.
  128 +# Then, you can make 'all' with parallelism turned on.
  129 +first: $(POSTGRES_DEPEND)
  130 +
  131 +
  132 +#############################################################################
  133 +#
  134 +# Partial objects for platforms with slow linkers.
  135 +#
  136 +ifeq ($(BIGOBJS), true)
  137 +
  138 +OBJS_ACCESS:= $(SRCS_ACCESS:%.c=$(objdir)/%.o)
  139 +OBJS_BOOTSTRAP:= $(SRCS_BOOTSTRAP:%.c=$(objdir)/%.o)
  140 +OBJS_CATALOG:= $(SRCS_CATALOG:%.c=$(objdir)/%.o)
  141 +OBJS_COMMANDS:= $(SRCS_COMMANDS:%.c=$(objdir)/%.o)
  142 +OBJS_EXECUTOR:= $(SRCS_EXECUTOR:%.c=$(objdir)/%.o)
  143 +OBJS_MAIN:= $(SRCS_MAIN:%.c=$(objdir)/%.o)
  144 +OBJS_POSTMASTER:= $(SRCS_POSTMASTER:%.c=$(objdir)/%.o)
  145 +OBJS_LIB:= $(SRCS_LIB:%.c=$(objdir)/%.o)
  146 +OBJS_LIBPQ:= $(SRCS_LIBPQ:%.c=$(objdir)/%.o)
  147 +OBJS_PORT:= $(addprefix $(objdir)/,$(subst .s,.o,$(SRCS_PORT:.c=.o)))
  148 +OBJS_NODES:= $(SRCS_NODES:%.c=$(objdir)/%.o)
  149 +OBJS_PARSER:= $(SRCS_PARSER:%.c=$(objdir)/%.o)
  150 +OBJS_OPTIMIZER:= $(SRCS_OPTIMIZER:%.c=$(objdir)/%.o)
  151 +OBJS_REGEX:= $(SRCS_REGEX:%.c=$(objdir)/%.o)
  152 +OBJS_REWRITE:= $(SRCS_REWRITE:%.c=$(objdir)/%.o)
  153 +OBJS_STORAGE:= $(SRCS_STORAGE:%.c=$(objdir)/%.o)
  154 +OBJS_TCOP:= $(SRCS_TCOP:%.c=$(objdir)/%.o)
  155 +OBJS_UTILS:= $(SRCS_UTILS:%.c=$(objdir)/%.o)
  156 +
  157 +ACCESS.o: $(OBJS_ACCESS)
  158 + $(make_partial)
  159 +BOOTSTRAP.o: $(OBJS_BOOTSTRAP)
  160 + $(make_partial)
  161 +COMMANDS.o: $(OBJS_COMMANDS)
  162 + $(make_partial)
  163 +EXECUTOR.o: $(OBJS_EXECUTOR)
  164 + $(make_partial)
  165 +MAIN.o: $(OBJS_MAIN) $(OBJS_POSTMASTER)
  166 + $(make_partial)
  167 +MISC.o: $(OBJS_CATALOG) $(OBJS_LIB) $(OBJS_LIBPQ) $(OBJS_PORT)
  168 + $(make_partial)
  169 +NODES.o: $(OBJS_NODES)
  170 + $(make_partial)
  171 +PARSER.o: $(OBJS_PARSER)
  172 + $(make_partial)
  173 +OPTIMIZER.o: $(OBJS_OPTIMIZER)
  174 + $(make_partial)
  175 +REGEX.o: $(OBJS_REGEX)
  176 + $(make_partial)
  177 +REWRITE.o: $(OBJS_REWRITE)
  178 + $(make_partial)
  179 +STORAGE.o: $(OBJS_STORAGE)
  180 + $(make_partial)
  181 +TCOP.o: $(OBJS_TCOP)
  182 + $(make_partial)
  183 +UTILS.o: $(OBJS_UTILS)
  184 + $(make_partial)
  185 +endif
  186 +
  187 +#############################################################################
  188 +#
  189 +# Installation.
  190 +#
  191 +# Install the bki files to the data directory. We also copy a version
  192 +# of them that has "PGUID" intact, so one can change the value of the
  193 +# postgres userid before running initdb in the case of customizing the
  194 +# binary release (i.e., fixing up PGUID w/o recompiling the system).
  195 +# Those files are copied out as foo.source. The program newbki(1) can
  196 +# be run later to reset the postgres login id (but it must be run before
  197 +# initdb is run, or after clearing the data directory with
  198 +# cleardbdir(1)). [newbki distributed with v4r2 but not with Postgres95.]
  199 +#
  200 +
  201 +# NAMEDATALEN=`egrep "^#define NAMEDATALEN" $(CURDIR)/include/postgres.h | awk '{print $$3}'`; \
  202 +# OIDNAMELEN=`egrep "^#define OIDNAMELEN" $(CURDIR)/include/postgres.h | awk '{print $$3}'`; \
  203 +
  204 +install: beforeinstall pg_id $(BKIFILES) postgres
  205 + $(INSTALL) $(INSTL_EXE_OPTS) $(objdir)/postgres $(DESTDIR)$(BINDIR)/postgres
  206 + @rm -f $(DESTDIR)$(BINDIR)/postmaster
  207 + cd $(DESTDIR)$(BINDIR); ln -s postgres postmaster
  208 + @cd $(objdir); \
  209 + PG_UID=`./pg_id $(POSTGRESLOGIN)`; \
  210 + POSTGRESLOGIN=$(POSTGRESLOGIN);\
  211 + echo "NAMEDATALEN = $(NAMEDATALEN)"; \
  212 + echo "OIDNAMELEN = $(OIDNAMELEN)"; \
  213 + case $$PG_UID in "NOUSER") \
  214 + echo "Warning: no account named $(POSTGRESLOGIN), using yours";\
  215 + POSTGRESLOGIN=`whoami`; \
  216 + PG_UID=`./pg_id`;; \
  217 + esac ;\
  218 + for bki in $(BKIFILES); do \
  219 + sed \
  220 + -e "s/postgres PGUID/$$POSTGRESLOGIN $$PG_UID/" \
  221 + -e "s/NAMEDATALEN/$(NAMEDATALEN)/g" \
  222 + -e "s/OIDNAMELEN/$(OIDNAMELEN)/g" \
  223 + -e "s/PGUID/$$PG_UID/" \
  224 + < $$bki > $$bki.sed ; \
  225 + echo "Installing $(DESTDIR)$(DATADIR)/files/$$bki."; \
  226 + $(INSTALL) $(INSTLOPTS) \
  227 + $$bki.sed $(DESTDIR)$(DATADIR)/files/$$bki; \
  228 + rm -f $$bki.sed; \
  229 + echo "Installing $(DESTDIR)$(DATADIR)/files/$$bki.source."; \
  230 + $(INSTALL) $(INSTLOPTS) \
  231 + $$bki $(DESTDIR)$(DATADIR)/files/$$bki.source; \
  232 + done;
  233 + @echo "Installing $(DATADIR)/pg_hba";
  234 + @cp $(srcdir)/libpq/pg_hba $(DATADIR)
  235 + @chmod 644 $(DATADIR)/pg_hba
  236 +
  237 +
  238 +# so we can get the UID of the postgres owner (w/o moving pg_id to
  239 +# src/tools). We just want the vanilla LDFLAGS for pg_id
  240 +IDLDFLAGS:= $(LDFLAGS)
  241 +ifeq ($(PORTNAME), hpux)
  242 +ifeq ($(CC), cc)
  243 +IDLDFLAGS+= -Aa -D_HPUX_SOURCE
  244 +endif
  245 +endif
  246 +pg_id: $(srcdir)/bin/pg_id/pg_id.c
  247 + $(CC) $(IDLDFLAGS) -o $(objdir)/$(@F) $<
  248 +
  249 +CLEANFILES+= pg_id postgres
  250 +
  251 +
  252 +#############################################################################
  253 +#
  254 +# Support for code development.
  255 +#
  256 +
  257 +#
  258 +# Build the file, "./ID", used by the "gid" (grep-for-identifier) tool
  259 +#
  260 +IDFILE= ID
  261 +.PHONY: $(IDFILE)
  262 +$(IDFILE):
  263 + $(CURDIR)/makeID $(PORTNAME)
  264 +
  265 +#
  266 +# Special rule to generate cpp'd version of a .c file. This is
  267 +# especially useful given all the hellish macro processing going on.
  268 +# The cpp'd version has a .C suffix. To create foo.C from foo.c, just
  269 +# type
  270 +# bmake foo.C
  271 +#
  272 +%.cpp: %.c
  273 + $(CC) -E $(CFLAGS) $(<:.C=.c) | cat -s | cb | tr -s '\012*' '\012' > $(objdir)/$(@F)
  274 +
  275 +cppall: $(SRCS:.c=.cpp)
  276 +
  277 +#
  278 +# To use Purify (SunOS only), define PURIFY to be the path (and
  279 +# options) with which to invoke the Purify loader. Only the executable
  280 +# needs to be loaded with Purify.
  281 +#
  282 +# PURIFY = /usr/sww/bin/purify -cache-dir=/usr/local/postgres/src/backend/purify-cache
  283 +#.if defined(PURIFY)
  284 +#${PROG}: $(POSTGRES_DEPEND) $(OBJS) $(EXPORTS)
  285 +# ${PURIFY} ${CC} ${LDFLAGS} -o $(objdir)/$(@F) $(addprefix $(objdir)/,$(notdir $(OBJS))) $(LDADD)
  286 +#
  287 +#CLEANFILES+= .purify* .pure .lock.*.o *_pure_*.o *.pure_*link*
  288 +#.endif
  289 +
35 src/backend/access/Makefile.inc
... ... @@ -0,0 +1,35 @@
  1 +#-------------------------------------------------------------------------
  2 +#
  3 +# Makefile.inc--
  4 +# Makefile for the access methods module
  5 +#
  6 +# Copyright (c) 1994, Regents of the University of California
  7 +#
  8 +#
  9 +# IDENTIFICATION
  10 +# $Header: /cvsroot/pgsql/src/backend/access/Attic/Makefile.inc,v 1.1.1.1 1996/07/09 06:21:08 scrappy Exp $
  11 +#
  12 +#-------------------------------------------------------------------------
  13 +
  14 +accdir=$(CURDIR)/access
  15 +VPATH:=$(VPATH):$(accdir):\
  16 + $(accdir)/common:$(accdir)/hash:$(accdir)/heap:$(accdir)/index:\
  17 + $(accdir)/rtree:$(accdir)/nbtree:$(accdir)/transam
  18 +
  19 +
  20 +SUBSRCS=
  21 +include $(accdir)/common/Makefile.inc
  22 +include $(accdir)/hash/Makefile.inc
  23 +include $(accdir)/heap/Makefile.inc
  24 +include $(accdir)/index/Makefile.inc
  25 +include $(accdir)/rtree/Makefile.inc
  26 +include $(accdir)/nbtree/Makefile.inc
  27 +include $(accdir)/transam/Makefile.inc
  28 +SRCS_ACCESS:= $(SUBSRCS)
  29 +
  30 +HEADERS+= attnum.h funcindex.h genam.h hash.h \
  31 + heapam.h hio.h htup.h ibit.h iqual.h istrat.h \
  32 + itup.h nbtree.h printtup.h relscan.h rtree.h \
  33 + sdir.h skey.h strat.h transam.h tupdesc.h tupmacs.h \
  34 + valid.h xact.h
  35 +
61 src/backend/access/attnum.h
... ... @@ -0,0 +1,61 @@
  1 +/*-------------------------------------------------------------------------
  2 + *
  3 + * attnum.h--
  4 + * POSTGRES attribute number definitions.
  5 + *
  6 + *
  7 + * Copyright (c) 1994, Regents of the University of California
  8 + *
  9 + * $Id: attnum.h,v 1.1.1.1 1996/07/09 06:21:08 scrappy Exp $
  10 + *
  11 + *-------------------------------------------------------------------------
  12 + */
  13 +#ifndef ATTNUM_H
  14 +#define ATTNUM_H
  15 +
  16 +#include "c.h"
  17 +
  18 +/*
  19 + * user defined attribute numbers start at 1. -ay 2/95
  20 + */
  21 +typedef int16 AttrNumber;
  22 +
  23 +#define InvalidAttrNumber 0
  24 +
  25 +/* ----------------
  26 + * support macros
  27 + * ----------------
  28 + */
  29 +/*
  30 + * AttributeNumberIsValid --
  31 + * True iff the attribute number is valid.
  32 + */
  33 +#define AttributeNumberIsValid(attributeNumber) \
  34 + ((bool) ((attributeNumber) != InvalidAttrNumber))
  35 +
  36 +/*
  37 + * AttrNumberIsForUserDefinedAttr --
  38 + * True iff the attribute number corresponds to an user defined attribute.
  39 + */
  40 +#define AttrNumberIsForUserDefinedAttr(attributeNumber) \
  41 + ((bool) ((attributeNumber) > 0))
  42 +
  43 +/*
  44 + * AttrNumberGetAttrOffset --
  45 + * Returns the attribute offset for an attribute number.
  46 + *
  47 + * Note:
  48 + * Assumes the attribute number is for an user defined attribute.
  49 + */
  50 +#define AttrNumberGetAttrOffset(attNum) \
  51 + (AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)) ? \
  52 + ((attNum - 1)) : 0)
  53 +
  54 +/*
  55 + * AttributeOffsetGetAttributeNumber --
  56 + * Returns the attribute number for an attribute offset.
  57 + */
  58 +#define AttrOffsetGetAttrNumber(attributeOffset) \
  59 + ((AttrNumber) (1 + attributeOffset))
  60 +
  61 +#endif /* ATTNUM_H */
16 src/backend/access/common/Makefile.inc
... ... @@ -0,0 +1,16 @@
  1 +#-------------------------------------------------------------------------
  2 +#
  3 +# Makefile.inc--
  4 +# Makefile for access/common
  5 +#
  6 +# Copyright (c) 1994, Regents of the University of California
  7 +#
  8 +#
  9 +# IDENTIFICATION
  10 +# $Header: /cvsroot/pgsql/src/backend/access/common/Attic/Makefile.inc,v 1.1.1.1 1996/07/09 06:21:09 scrappy Exp $
  11 +#
  12 +#-------------------------------------------------------------------------
  13 +
  14 +SUBSRCS+= heaptuple.c heapvalid.c indextuple.c indexvalid.c printtup.c \
  15 + scankey.c tupdesc.c
  16 +
1,011 src/backend/access/common/heaptuple.c
... ... @@ -0,0 +1,1011 @@
  1 +/*-------------------------------------------------------------------------
  2 + *
  3 + * heaptuple.c--
  4 + * This file contains heap tuple accessor and mutator routines, as well
  5 + * as a few various tuple utilities.
  6 + *
  7 + * Copyright (c) 1994, Regents of the University of California
  8 + *
  9 + *
  10 + * IDENTIFICATION
  11 + * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.1.1.1 1996/07/09 06:21:09 scrappy Exp $
  12 + *
  13 + * NOTES
  14 + * The old interface functions have been converted to macros
  15 + * and moved to heapam.h
  16 + *
  17 + *-------------------------------------------------------------------------
  18 + */
  19 +#include <string.h>
  20 +
  21 +#include "postgres.h"
  22 +
  23 +#include "access/htup.h"
  24 +#include "access/itup.h"
  25 +#include "access/tupmacs.h"
  26 +#include "access/skey.h"
  27 +#include "storage/ipc.h"
  28 +#include "storage/buf.h"
  29 +#include "storage/bufmgr.h"
  30 +#include "access/transam.h"
  31 +#include "storage/bufpage.h" /* for MAXTUPLEN */
  32 +#include "storage/itemptr.h"
  33 +#include "utils/memutils.h"
  34 +#include "utils/elog.h"
  35 +#include "utils/palloc.h"
  36 +#include "utils/rel.h"
  37 +#include "utils/nabstime.h"
  38 +
  39 +/* this is so the sparcstation debugger works */
  40 +
  41 +#ifndef NO_ASSERT_CHECKING
  42 +#ifdef sparc
  43 +#define register
  44 +#endif /* sparc */
  45 +#endif /* NO_ASSERT_CHECKING */
  46 +
  47 +/* ----------------------------------------------------------------
  48 + * misc support routines
  49 + * ----------------------------------------------------------------
  50 + */
  51 +
  52 +/* ----------------
  53 + * ComputeDataSize
  54 + * ----------------
  55 + */
  56 +Size
  57 +ComputeDataSize(TupleDesc tupleDesc,
  58 + Datum value[],
  59 + char nulls[])
  60 +{
  61 + uint32 length;
  62 + int i;
  63 + int numberOfAttributes = tupleDesc->natts;
  64 + AttributeTupleForm *att = tupleDesc->attrs;
  65 +
  66 + for (length = 0, i = 0; i < numberOfAttributes; i++) {
  67 + if (nulls[i] != ' ') continue;
  68 +
  69 + switch (att[i]->attlen) {
  70 + case -1:
  71 + /*
  72 + * This is the size of the disk representation and so
  73 + * must include the additional sizeof long.
  74 + */
  75 + if (att[i]->attalign == 'd') {
  76 + length = DOUBLEALIGN(length)
  77 + + VARSIZE(DatumGetPointer(value[i]));
  78 + } else {
  79 + length = INTALIGN(length)
  80 + + VARSIZE(DatumGetPointer(value[i]));
  81 + }
  82 + break;
  83 + case sizeof(char):
  84 + length++;
  85 + break;
  86 + case sizeof(short):
  87 + length = SHORTALIGN(length + sizeof(short));
  88 + break;
  89 + case sizeof(int32):
  90 + length = INTALIGN(length + sizeof(int32));
  91 + break;
  92 + default:
  93 + if (att[i]->attlen < sizeof(int32))
  94 + elog(WARN, "ComputeDataSize: attribute %d has len %d",
  95 + i, att[i]->attlen);
  96 + if (att[i]->attalign == 'd')
  97 + length = DOUBLEALIGN(length) + att[i]->attlen;
  98 + else
  99 + length = LONGALIGN(length) + att[i]->attlen;
  100 + break;
  101 + }
  102 + }
  103 +
  104 + return length;
  105 +}
  106 +
  107 +/* ----------------
  108 + * DataFill
  109 + * ----------------
  110 + */
  111 +void
  112 +DataFill(char *data,
  113 + TupleDesc tupleDesc,
  114 + Datum value[],
  115 + char nulls[],
  116 + char *infomask,
  117 + bits8 bit[])
  118 +{
  119 + bits8 *bitP;
  120 + int bitmask;
  121 + uint32 length;
  122 + int i;
  123 + int numberOfAttributes = tupleDesc->natts;
  124 + AttributeTupleForm* att = tupleDesc->attrs;
  125 +
  126 + if (bit != NULL) {
  127 + bitP = &bit[-1];
  128 + bitmask = CSIGNBIT;
  129 + }
  130 +
  131 + *infomask = 0;
  132 +
  133 + for (i = 0; i < numberOfAttributes; i++) {
  134 + if (bit != NULL) {
  135 + if (bitmask != CSIGNBIT) {
  136 + bitmask <<= 1;
  137 + } else {
  138 + bitP += 1;
  139 + *bitP = 0x0;
  140 + bitmask = 1;
  141 + }
  142 +
  143 + if (nulls[i] == 'n') {
  144 + *infomask |= HEAP_HASNULL;
  145 + continue;
  146 + }
  147 +
  148 + *bitP |= bitmask;
  149 + }
  150 +
  151 + switch (att[i]->attlen) {
  152 + case -1:
  153 + *infomask |= HEAP_HASVARLENA;
  154 + if (att[i]->attalign=='d') {
  155 + data = (char *) DOUBLEALIGN(data);
  156 + } else {
  157 + data = (char *) INTALIGN(data);
  158 + }
  159 + length = VARSIZE(DatumGetPointer(value[i]));
  160 + memmove(data, DatumGetPointer(value[i]),length);
  161 + data += length;
  162 + break;
  163 + case sizeof(char):
  164 + *data = att[i]->attbyval ?
  165 + DatumGetChar(value[i]) : *((char *) value[i]);
  166 + data += sizeof(char);
  167 + break;
  168 + case sizeof(int16):
  169 + data = (char *) SHORTALIGN(data);
  170 + * (short *) data = (att[i]->attbyval ?
  171 + DatumGetInt16(value[i]) :
  172 + *((short *) value[i]));
  173 + data += sizeof(short);
  174 + break;
  175 + case sizeof(int32):
  176 + data = (char *) INTALIGN(data);
  177 + * (int32 *) data = (att[i]->attbyval ?
  178 + DatumGetInt32(value[i]) :
  179 + *((int32 *) value[i]));
  180 + data += sizeof(int32);
  181 + break;
  182 + default:
  183 + if (att[i]->attlen < sizeof(int32))
  184 + elog(WARN, "DataFill: attribute %d has len %d",
  185 + i, att[i]->attlen);
  186 + if (att[i]->attalign == 'd') {
  187 + data = (char *) DOUBLEALIGN(data);
  188 + memmove(data, DatumGetPointer(value[i]),
  189 + att[i]->attlen);
  190 + data += att[i]->attlen;
  191 + } else {
  192 + data = (char *) LONGALIGN(data);
  193 + memmove(data, DatumGetPointer(value[i]),
  194 + att[i]->attlen);
  195 + data += att[i]->attlen;
  196 + }
  197 +
  198 + }
  199 + }
  200 +}
  201 +
  202 +/* ----------------------------------------------------------------
  203 + * heap tuple interface
  204 + * ----------------------------------------------------------------
  205 + */
  206 +
  207 +/* ----------------
  208 + * heap_attisnull - returns 1 iff tuple attribute is not present
  209 + * ----------------
  210 + */
  211 +int
  212 +heap_attisnull(HeapTuple tup, int attnum)
  213 +{
  214 + if (attnum > (int)tup->t_natts)
  215 + return (1);
  216 +
  217 + if (HeapTupleNoNulls(tup)) return(0);
  218 +
  219 + if (attnum > 0) {
  220 + return(att_isnull(attnum - 1, tup->t_bits));
  221 + } else
  222 + switch (attnum) {
  223 + case SelfItemPointerAttributeNumber:
  224 + case ObjectIdAttributeNumber:
  225 + case MinTransactionIdAttributeNumber:
  226 + case MinCommandIdAttributeNumber:
  227 + case MaxTransactionIdAttributeNumber:
  228 + case MaxCommandIdAttributeNumber:
  229 + case ChainItemPointerAttributeNumber:
  230 + case AnchorItemPointerAttributeNumber:
  231 + case MinAbsoluteTimeAttributeNumber:
  232 + case MaxAbsoluteTimeAttributeNumber:
  233 + case VersionTypeAttributeNumber:
  234 + break;
  235 +
  236 + case 0:
  237 + elog(WARN, "heap_attisnull: zero attnum disallowed");
  238 +
  239 + default:
  240 + elog(WARN, "heap_attisnull: undefined negative attnum");
  241 + }
  242 +
  243 + return (0);
  244 +}
  245 +
  246 +/* ----------------------------------------------------------------
  247 + * system attribute heap tuple support
  248 + * ----------------------------------------------------------------
  249 + */
  250 +
  251 +/* ----------------
  252 + * heap_sysattrlen
  253 + *
  254 + * This routine returns the length of a system attribute.
  255 + * ----------------
  256 + */
  257 +int
  258 +heap_sysattrlen(AttrNumber attno)
  259 +{
  260 + HeapTupleData *f = NULL;
  261 + int len;
  262 +
  263 + switch (attno) {
  264 + case SelfItemPointerAttributeNumber:
  265 + len = sizeof f->t_ctid;
  266 + break;
  267 + case ObjectIdAttributeNumber:
  268 + len = sizeof f->t_oid;
  269 + break;
  270 + case MinTransactionIdAttributeNumber:
  271 + len = sizeof f->t_xmin;
  272 + break;
  273 + case MinCommandIdAttributeNumber:
  274 + len = sizeof f->t_cmin;
  275 + break;
  276 + case MaxTransactionIdAttributeNumber:
  277 + len = sizeof f->t_xmax;
  278 + break;
  279 + case MaxCommandIdAttributeNumber:
  280 + len = sizeof f->t_cmax;
  281 + break;
  282 + case ChainItemPointerAttributeNumber:
  283 + len = sizeof f->t_chain;
  284 + break;
  285 + case AnchorItemPointerAttributeNumber:
  286 + elog(WARN, "heap_sysattrlen: field t_anchor does not exist!");
  287 + break;
  288 + case MinAbsoluteTimeAttributeNumber:
  289 + len = sizeof f->t_tmin;
  290 + break;
  291 + case MaxAbsoluteTimeAttributeNumber:
  292 + len = sizeof f->t_tmax;
  293 + break;
  294 + case VersionTypeAttributeNumber:
  295 + len = sizeof f->t_vtype;
  296 + break;
  297 + default:
  298 + elog(WARN, "sysattrlen: System attribute number %d unknown.",
  299 + attno);
  300 + len = 0;
  301 + break;
  302 + }
  303 + return (len);
  304 +}
  305 +
  306 +/* ----------------
  307 + * heap_sysattrbyval
  308 + *
  309 + * This routine returns the "by-value" property of a system attribute.
  310 + * ----------------
  311 + */
  312 +bool
  313 +heap_sysattrbyval(AttrNumber attno)
  314 +{
  315 + bool byval;
  316 +
  317 + switch (attno) {
  318 + case SelfItemPointerAttributeNumber:
  319 + byval = false;
  320 + break;
  321 + case ObjectIdAttributeNumber:
  322 + byval = true;
  323 + break;
  324 + case MinTransactionIdAttributeNumber:
  325 + byval = true;
  326 + break;
  327 + case MinCommandIdAttributeNumber:
  328 + byval = true;
  329 + break;
  330 + case MaxTransactionIdAttributeNumber:
  331 + byval = true;
  332 + break;
  333 + case MaxCommandIdAttributeNumber:
  334 + byval = true;
  335 + break;
  336 + case ChainItemPointerAttributeNumber:
  337 + byval = false;
  338 + break;
  339 + case AnchorItemPointerAttributeNumber:
  340 + byval = false;
  341 + break;
  342 + case MinAbsoluteTimeAttributeNumber:
  343 + byval = true;
  344 + break;
  345 + case MaxAbsoluteTimeAttributeNumber:
  346 + byval = true;
  347 + break;