From 05dedace84ef8c93fea5309c3ac55f889011429b Mon Sep 17 00:00:00 2001 From: CVS to git conversion script Date: Thu, 20 Jun 2002 20:29:55 +0000 Subject: This commit was manufactured by cvs2git to create branch 'ecpg_big_bison'. Sprout from master 2002-06-20 20:29:54 UTC Bruce Momjian 'Update copyright to 2002.' Delete: COPYRIGHT GNUmakefile.in HISTORY INSTALL Makefile README aclocal.m4 config/ac_func_accept_argtypes.m4 config/c-compiler.m4 config/c-library.m4 config/config.guess config/config.sub config/cxx.m4 config/docbook.m4 config/general.m4 config/install-sh config/java.m4 config/libtool.m4 config/missing config/mkinstalldirs config/perl.m4 config/prep_buildtree config/programs.m4 config/python.m4 config/tcl.m4 configure configure.in contrib/Makefile contrib/README contrib/array/Makefile contrib/array/README.array_iterator contrib/array/array_iterator.c contrib/array/array_iterator.h contrib/array/array_iterator.sql.in contrib/btree_gist/Makefile contrib/btree_gist/README.btree_gist contrib/btree_gist/btree_gist.c contrib/btree_gist/btree_gist.sql.in contrib/btree_gist/data/test_btree.data contrib/btree_gist/data/test_btree_ts.data contrib/btree_gist/expected/btree_gist.out contrib/btree_gist/sql/btree_gist.sql contrib/chkpass/Makefile contrib/chkpass/README.chkpass contrib/chkpass/chkpass.c contrib/chkpass/chkpass.sql.in contrib/contrib-global.mk contrib/cube/Makefile contrib/cube/README.cube contrib/cube/buffer.c contrib/cube/buffer.h contrib/cube/cube.c contrib/cube/cube.sql.in contrib/cube/cubedata.h contrib/cube/cubeparse.y contrib/cube/cubescan.l contrib/cube/data/test_cube.data contrib/cube/expected/cube.out contrib/cube/sql/cube.sql contrib/dbase/Makefile contrib/dbase/README.dbf2pg contrib/dbase/dbf.c contrib/dbase/dbf.h contrib/dbase/dbf2pg.1 contrib/dbase/dbf2pg.c contrib/dbase/endian.c contrib/dblink/Makefile contrib/dblink/README.dblink contrib/dblink/dblink.c contrib/dblink/dblink.h contrib/dblink/dblink.sql.in contrib/dbsize/Makefile contrib/dbsize/README.dbsize contrib/dbsize/dbsize.c contrib/dbsize/dbsize.sql.in contrib/earthdistance/Makefile contrib/earthdistance/README.earthdistance contrib/earthdistance/earthdistance.c contrib/earthdistance/earthdistance.sql.in contrib/findoidjoins/Makefile contrib/findoidjoins/README.findoidjoins contrib/findoidjoins/findoidjoins.c contrib/findoidjoins/make_oidjoins_check contrib/fulltextindex/Makefile contrib/fulltextindex/README.fti contrib/fulltextindex/TODO contrib/fulltextindex/fti.c contrib/fulltextindex/fti.pl contrib/fulltextindex/fti.sql.in contrib/fulltextindex/timings.sh contrib/fuzzystrmatch/Makefile contrib/fuzzystrmatch/README.fuzzystrmatch contrib/fuzzystrmatch/README.soundex contrib/fuzzystrmatch/fuzzystrmatch.c contrib/fuzzystrmatch/fuzzystrmatch.h contrib/fuzzystrmatch/fuzzystrmatch.sql.in contrib/intagg/Makefile contrib/intagg/README.int_aggregate contrib/intagg/int_aggregate.c contrib/intagg/int_aggregate.sql.in contrib/intarray/Makefile contrib/intarray/README.intarray contrib/intarray/_int.c contrib/intarray/_int.sql.in contrib/intarray/bench/bench.pl contrib/intarray/bench/create_test.pl contrib/intarray/data/test__int.data contrib/intarray/expected/_int.out contrib/intarray/sql/_int.sql contrib/ipc_check/README contrib/ipc_check/ipc_check.pl contrib/isbn_issn/Makefile contrib/isbn_issn/README.isbn_issn contrib/isbn_issn/isbn_issn.c contrib/isbn_issn/isbn_issn.sql.in contrib/lo/Makefile contrib/lo/README.lo contrib/lo/lo.c contrib/lo/lo.sql.in contrib/lo/lo_drop.sql contrib/lo/lo_test.sql contrib/mSQL-interface/Makefile contrib/mSQL-interface/README.mpgsql contrib/mSQL-interface/mpgsql.c contrib/mac/README.mac contrib/mac/createoui contrib/mac/dropoui contrib/mac/ouiparse.awk contrib/mac/updateoui contrib/miscutil/Makefile contrib/miscutil/README.misc_utils contrib/miscutil/misc_utils.c contrib/miscutil/misc_utils.h contrib/miscutil/misc_utils.sql.in contrib/mysql/README contrib/mysql/my2pg.pl contrib/mysql/mysql2pgsql contrib/noupdate/Makefile contrib/noupdate/README.noup contrib/noupdate/noup.c contrib/noupdate/noup.sql.in contrib/oid2name/Makefile contrib/oid2name/README.oid2name contrib/oid2name/oid2name.c contrib/oracle/CHANGES contrib/oracle/Ora2Pg.pm contrib/oracle/README.ora2pg contrib/oracle/TODO contrib/oracle/ora2pg.html contrib/oracle/ora2pg.pl contrib/pg_controldata/Makefile contrib/pg_controldata/README.pg_controldata contrib/pg_controldata/pg_controldata.c contrib/pg_dumplo/Makefile contrib/pg_dumplo/README.pg_dumplo contrib/pg_dumplo/lo_export.c contrib/pg_dumplo/lo_import.c contrib/pg_dumplo/main.c contrib/pg_dumplo/pg_dumplo.h contrib/pg_dumplo/utils.c contrib/pg_logger/Makefile contrib/pg_logger/README.pg_logger contrib/pg_logger/pg_logger.c contrib/pg_resetxlog/Makefile contrib/pg_resetxlog/README.pg_resetxlog contrib/pg_resetxlog/pg_resetxlog.c contrib/pg_upgrade/README contrib/pg_upgrade/pg_upgrade contrib/pg_upgrade/pg_upgrade.1 contrib/pgbench/Makefile contrib/pgbench/README.pgbench contrib/pgbench/README.pgbench_jis contrib/pgbench/pgbench.c contrib/pgcrypto/API contrib/pgcrypto/Makefile contrib/pgcrypto/README.pgcrypto contrib/pgcrypto/blf.c contrib/pgcrypto/blf.h contrib/pgcrypto/crypt-blowfish.c contrib/pgcrypto/crypt-des.c contrib/pgcrypto/crypt-gensalt.c contrib/pgcrypto/crypt-md5.c contrib/pgcrypto/expected/blowfish.out contrib/pgcrypto/expected/crypt-blowfish.out contrib/pgcrypto/expected/crypt-des.out contrib/pgcrypto/expected/crypt-md5.out contrib/pgcrypto/expected/crypt-xdes.out contrib/pgcrypto/expected/hmac-md5.out contrib/pgcrypto/expected/hmac-sha1.out contrib/pgcrypto/expected/init.out contrib/pgcrypto/expected/md5.out contrib/pgcrypto/expected/rijndael.out contrib/pgcrypto/expected/sha1.out contrib/pgcrypto/internal.c contrib/pgcrypto/md5.c contrib/pgcrypto/md5.h contrib/pgcrypto/mhash.c contrib/pgcrypto/misc.c contrib/pgcrypto/openssl.c contrib/pgcrypto/pgcrypto.c contrib/pgcrypto/pgcrypto.h contrib/pgcrypto/pgcrypto.sql.in contrib/pgcrypto/px-crypt.c contrib/pgcrypto/px-crypt.h contrib/pgcrypto/px-hmac.c contrib/pgcrypto/px.c contrib/pgcrypto/px.h contrib/pgcrypto/random.c contrib/pgcrypto/rijndael.c contrib/pgcrypto/rijndael.h contrib/pgcrypto/rijndael.tbl contrib/pgcrypto/sha1.c contrib/pgcrypto/sha1.h contrib/pgcrypto/sql/blowfish.sql contrib/pgcrypto/sql/crypt-blowfish.sql contrib/pgcrypto/sql/crypt-des.sql contrib/pgcrypto/sql/crypt-md5.sql contrib/pgcrypto/sql/crypt-xdes.sql contrib/pgcrypto/sql/hmac-md5.sql contrib/pgcrypto/sql/hmac-sha1.sql contrib/pgcrypto/sql/init.sql contrib/pgcrypto/sql/md5.sql contrib/pgcrypto/sql/rijndael.sql contrib/pgcrypto/sql/sha1.sql contrib/pgstattuple/Makefile contrib/pgstattuple/README.pgstattuple contrib/pgstattuple/README.pgstattuple.euc_jp contrib/pgstattuple/pgstattuple.c contrib/pgstattuple/pgstattuple.sql.in contrib/retep/CHANGELOG contrib/retep/Implementation contrib/retep/Makefile contrib/retep/README contrib/retep/build.xml contrib/retep/data/cds.dtd contrib/retep/data/cds.xml contrib/retep/retep.jpx contrib/retep/uk/org/retep/dtu/DCollection.java contrib/retep/uk/org/retep/dtu/DConstants.java contrib/retep/uk/org/retep/dtu/DElement.java contrib/retep/uk/org/retep/dtu/DEnvironment.java contrib/retep/uk/org/retep/dtu/DModule.java contrib/retep/uk/org/retep/dtu/DModuleXML.java contrib/retep/uk/org/retep/dtu/DNode.java contrib/retep/uk/org/retep/dtu/DProcessor.java contrib/retep/uk/org/retep/dtu/DTransform.java contrib/retep/uk/org/retep/tools/Tool.java contrib/retep/uk/org/retep/tools.properties contrib/retep/uk/org/retep/util/ExceptionDialog.java contrib/retep/uk/org/retep/util/Globals.java contrib/retep/uk/org/retep/util/Logger.java contrib/retep/uk/org/retep/util/Main.java contrib/retep/uk/org/retep/util/StandaloneApp.java contrib/retep/uk/org/retep/util/hba/Editor.java contrib/retep/uk/org/retep/util/hba/Main.java contrib/retep/uk/org/retep/util/hba/Record.java contrib/retep/uk/org/retep/util/misc/IPAddress.java contrib/retep/uk/org/retep/util/misc/PropertiesIO.java contrib/retep/uk/org/retep/util/misc/WStringTokenizer.java contrib/retep/uk/org/retep/util/models/HBATableModel.java contrib/retep/uk/org/retep/util/models/PropertiesTableModel.java contrib/retep/uk/org/retep/util/proped/Main.java contrib/retep/uk/org/retep/util/proped/PropertyEditor.java contrib/retep/uk/org/retep/xml/core/XMLFactory.java contrib/retep/uk/org/retep/xml/core/XMLFactoryException.java contrib/retep/uk/org/retep/xml/jdbc/XMLDatabase.java contrib/retep/uk/org/retep/xml/jdbc/XMLResultSet.java contrib/retep/uk/org/retep/xml/parser/TagHandler.java contrib/retep/uk/org/retep/xml/parser/TagListener.java contrib/retep/uk/org/retep/xml/test/XMLExport.java contrib/rserv/ApplySnapshot.in contrib/rserv/CleanLog.in contrib/rserv/GetSyncID.in contrib/rserv/InitRservTest.in contrib/rserv/Makefile contrib/rserv/MasterAddTable.in contrib/rserv/MasterInit.in contrib/rserv/MasterSync.in contrib/rserv/PrepareSnapshot.in contrib/rserv/README.rserv contrib/rserv/RServ.pm contrib/rserv/Replicate.in contrib/rserv/RservTest.in contrib/rserv/SlaveAddTable.in contrib/rserv/SlaveInit.in contrib/rserv/master.sql.in contrib/rserv/regress.sh contrib/rserv/rserv.c contrib/rserv/slave.sql.in contrib/rtree_gist/Makefile contrib/rtree_gist/README.rtree_gist contrib/rtree_gist/bench/bench.pl contrib/rtree_gist/bench/create_test.pl contrib/rtree_gist/data/test_box.data contrib/rtree_gist/expected/rtree_gist.out contrib/rtree_gist/rtree_gist.c contrib/rtree_gist/rtree_gist.sql.in contrib/rtree_gist/sql/rtree_gist.sql contrib/seg/Makefile contrib/seg/README.seg contrib/seg/buffer.c contrib/seg/buffer.h contrib/seg/data/test_seg.data contrib/seg/expected/seg.out contrib/seg/seg-validate.pl contrib/seg/seg.c contrib/seg/seg.sql.in contrib/seg/segdata.h contrib/seg/segparse.y contrib/seg/segscan.l contrib/seg/sort-segments.pl contrib/seg/sql/seg.sql contrib/spi/Makefile contrib/spi/README.spi contrib/spi/autoinc.c contrib/spi/autoinc.example contrib/spi/autoinc.sql.in contrib/spi/insert_username.c contrib/spi/insert_username.example contrib/spi/insert_username.sql.in contrib/spi/moddatetime.c contrib/spi/moddatetime.example contrib/spi/moddatetime.sql.in contrib/spi/preprocessor/README.MAX contrib/spi/preprocessor/example.sql contrib/spi/preprocessor/step1.c contrib/spi/preprocessor/step1.e contrib/spi/preprocessor/step2.pl contrib/spi/refint.c contrib/spi/refint.example contrib/spi/refint.sql.in contrib/spi/timetravel.c contrib/spi/timetravel.example contrib/spi/timetravel.sql.in contrib/start-scripts/freebsd contrib/start-scripts/linux contrib/string/Makefile contrib/string/README.string_io contrib/string/string_io.c contrib/string/string_io.h contrib/string/string_io.sql.in contrib/tips/Makefile contrib/tips/README.apachelog contrib/tools/add-emacs-variables contrib/tools/find-sources contrib/tools/make-tags contrib/tsearch/Makefile contrib/tsearch/README.tsearch contrib/tsearch/crc32.c contrib/tsearch/crc32.h contrib/tsearch/data/test_tsearch.data contrib/tsearch/deflex.h contrib/tsearch/dict/porter_english.dct contrib/tsearch/dict/russian_stemming.dct contrib/tsearch/dict.h contrib/tsearch/expected/tsearch.out contrib/tsearch/gistidx.c contrib/tsearch/gistidx.h contrib/tsearch/makedict/makedict.pl contrib/tsearch/morph.c contrib/tsearch/morph.h contrib/tsearch/parser.h contrib/tsearch/parser.l contrib/tsearch/query.c contrib/tsearch/query.h contrib/tsearch/rewrite.c contrib/tsearch/rewrite.h contrib/tsearch/sql/tsearch.sql contrib/tsearch/tsearch.sql.in contrib/tsearch/txtidx.c contrib/tsearch/txtidx.h contrib/userlock/Makefile contrib/userlock/README.user_locks contrib/userlock/user_locks.c contrib/userlock/user_locks.h contrib/userlock/user_locks.sql.in contrib/vacuumlo/Makefile contrib/vacuumlo/README.vacuumlo contrib/vacuumlo/vacuumlo.c contrib/xml/Makefile contrib/xml/README contrib/xml/TODO contrib/xml/pgxml.c contrib/xml/pgxml.h contrib/xml/pgxml.source contrib/xml/pgxml_dom.c contrib/xml/pgxml_dom.source doc/FAQ doc/FAQ_AIX doc/FAQ_DEV doc/FAQ_HPUX doc/FAQ_IRIX doc/FAQ_MSWIN doc/FAQ_QNX4 doc/FAQ_SCO doc/FAQ_Solaris doc/FAQ_german doc/FAQ_japanese doc/FAQ_polish doc/FAQ_russian doc/KNOWN_BUGS doc/MISSING_FEATURES doc/Makefile doc/README.mb.big5 doc/README.mb.jp doc/TODO doc/TODO.detail/README doc/TODO.detail/atttypmod doc/TODO.detail/crossdb doc/TODO.detail/cursor doc/TODO.detail/drop doc/TODO.detail/exists doc/TODO.detail/foreign doc/TODO.detail/fsync doc/TODO.detail/inheritance doc/TODO.detail/java doc/TODO.detail/mmap doc/TODO.detail/namedatalen doc/TODO.detail/optimizer doc/TODO.detail/performance doc/TODO.detail/persistent doc/TODO.detail/pool doc/TODO.detail/prepare doc/TODO.detail/privileges doc/TODO.detail/replication doc/TODO.detail/schema doc/TODO.detail/tablespaces doc/TODO.detail/thread doc/TODO.detail/transactions doc/TODO.detail/typeconv doc/TODO.detail/update doc/TODO.detail/vacuum doc/TODO.detail/view doc/TODO.detail/win32 doc/TODO.detail/yacc doc/bug.template doc/src/FAQ/FAQ.html doc/src/FAQ/FAQ_DEV.html doc/src/FAQ/FAQ_german.html doc/src/FAQ/FAQ_japanese.html doc/src/FAQ/FAQ_polish.html doc/src/FAQ/FAQ_russian.html doc/src/Makefile doc/src/graphics/catalogs.ag doc/src/graphics/catalogs.cgm doc/src/graphics/catalogs.gif doc/src/graphics/catalogs.ps doc/src/graphics/clientserver.ag doc/src/graphics/clientserver.gif doc/src/graphics/connections.ag doc/src/graphics/connections.gif doc/src/sgml/Makefile doc/src/sgml/admin.sgml doc/src/sgml/advanced.sgml doc/src/sgml/arch-dev.sgml doc/src/sgml/arch-pg.sgml doc/src/sgml/array.sgml doc/src/sgml/backup.sgml doc/src/sgml/biblio.sgml doc/src/sgml/bki.sgml doc/src/sgml/book-decl.sgml doc/src/sgml/catalogs.sgml doc/src/sgml/charset.sgml doc/src/sgml/client-auth.sgml doc/src/sgml/compiler.sgml doc/src/sgml/contacts.sgml doc/src/sgml/cvs.sgml doc/src/sgml/datatype.sgml doc/src/sgml/datetime.sgml doc/src/sgml/developer.sgml doc/src/sgml/dfunc.sgml doc/src/sgml/diskusage.sgml doc/src/sgml/docguide.sgml doc/src/sgml/ecpg.sgml doc/src/sgml/extend.sgml doc/src/sgml/features.sgml doc/src/sgml/filelist.sgml doc/src/sgml/fixrtf doc/src/sgml/func-ref.sgml doc/src/sgml/func.sgml doc/src/sgml/geqo.sgml doc/src/sgml/gist.sgml doc/src/sgml/history.sgml doc/src/sgml/indexcost.sgml doc/src/sgml/indices.sgml doc/src/sgml/info.sgml doc/src/sgml/inherit.sgml doc/src/sgml/install-win32.sgml doc/src/sgml/installation.sgml doc/src/sgml/intro.sgml doc/src/sgml/jdbc.sgml doc/src/sgml/keywords.sgml doc/src/sgml/legal.sgml doc/src/sgml/libpgeasy.sgml doc/src/sgml/libpgtcl.sgml doc/src/sgml/libpq++.sgml doc/src/sgml/libpq.sgml doc/src/sgml/lobj.sgml doc/src/sgml/maintenance.sgml doc/src/sgml/manage-ag.sgml doc/src/sgml/manage.sgml doc/src/sgml/monitoring.sgml doc/src/sgml/mvcc.sgml doc/src/sgml/nls.sgml doc/src/sgml/notation.sgml doc/src/sgml/odbc.sgml doc/src/sgml/page.sgml doc/src/sgml/perform.sgml doc/src/sgml/plperl.sgml doc/src/sgml/plpython.sgml doc/src/sgml/plsql.sgml doc/src/sgml/pltcl.sgml doc/src/sgml/postgres.sgml doc/src/sgml/problems.sgml doc/src/sgml/programmer.sgml doc/src/sgml/protocol.sgml doc/src/sgml/pygresql.sgml doc/src/sgml/queries.sgml doc/src/sgml/query.sgml doc/src/sgml/recovery.sgml doc/src/sgml/ref/abort.sgml doc/src/sgml/ref/allfiles.sgml doc/src/sgml/ref/alter_database.sgml doc/src/sgml/ref/alter_group.sgml doc/src/sgml/ref/alter_table.sgml doc/src/sgml/ref/alter_trigger.sgml doc/src/sgml/ref/alter_user.sgml doc/src/sgml/ref/analyze.sgml doc/src/sgml/ref/begin.sgml doc/src/sgml/ref/checkpoint.sgml doc/src/sgml/ref/close.sgml doc/src/sgml/ref/cluster.sgml doc/src/sgml/ref/comment.sgml doc/src/sgml/ref/commit.sgml doc/src/sgml/ref/copy.sgml doc/src/sgml/ref/create_aggregate.sgml doc/src/sgml/ref/create_constraint.sgml doc/src/sgml/ref/create_database.sgml doc/src/sgml/ref/create_domain.sgml doc/src/sgml/ref/create_function.sgml doc/src/sgml/ref/create_group.sgml doc/src/sgml/ref/create_index.sgml doc/src/sgml/ref/create_language.sgml doc/src/sgml/ref/create_operator.sgml doc/src/sgml/ref/create_rule.sgml doc/src/sgml/ref/create_schema.sgml doc/src/sgml/ref/create_sequence.sgml doc/src/sgml/ref/create_table.sgml doc/src/sgml/ref/create_table_as.sgml doc/src/sgml/ref/create_trigger.sgml doc/src/sgml/ref/create_type.sgml doc/src/sgml/ref/create_user.sgml doc/src/sgml/ref/create_view.sgml doc/src/sgml/ref/createdb.sgml doc/src/sgml/ref/createlang.sgml doc/src/sgml/ref/createuser.sgml doc/src/sgml/ref/current_date.sgml doc/src/sgml/ref/current_time.sgml doc/src/sgml/ref/current_timestamp.sgml doc/src/sgml/ref/current_user.sgml doc/src/sgml/ref/declare.sgml doc/src/sgml/ref/delete.sgml doc/src/sgml/ref/drop_aggregate.sgml doc/src/sgml/ref/drop_database.sgml doc/src/sgml/ref/drop_domain.sgml doc/src/sgml/ref/drop_function.sgml doc/src/sgml/ref/drop_group.sgml doc/src/sgml/ref/drop_index.sgml doc/src/sgml/ref/drop_language.sgml doc/src/sgml/ref/drop_operator.sgml doc/src/sgml/ref/drop_rule.sgml doc/src/sgml/ref/drop_sequence.sgml doc/src/sgml/ref/drop_table.sgml doc/src/sgml/ref/drop_trigger.sgml doc/src/sgml/ref/drop_type.sgml doc/src/sgml/ref/drop_user.sgml doc/src/sgml/ref/drop_view.sgml doc/src/sgml/ref/dropdb.sgml doc/src/sgml/ref/droplang.sgml doc/src/sgml/ref/dropuser.sgml doc/src/sgml/ref/ecpg-ref.sgml doc/src/sgml/ref/end.sgml doc/src/sgml/ref/explain.sgml doc/src/sgml/ref/fetch.sgml doc/src/sgml/ref/grant.sgml doc/src/sgml/ref/initdb.sgml doc/src/sgml/ref/initlocation.sgml doc/src/sgml/ref/insert.sgml doc/src/sgml/ref/ipcclean.sgml doc/src/sgml/ref/listen.sgml doc/src/sgml/ref/load.sgml doc/src/sgml/ref/lock.sgml doc/src/sgml/ref/move.sgml doc/src/sgml/ref/notify.sgml doc/src/sgml/ref/pg_config-ref.sgml doc/src/sgml/ref/pg_ctl-ref.sgml doc/src/sgml/ref/pg_dump.sgml doc/src/sgml/ref/pg_dumpall.sgml doc/src/sgml/ref/pg_restore.sgml doc/src/sgml/ref/pgaccess-ref.sgml doc/src/sgml/ref/pgtclsh.sgml doc/src/sgml/ref/pgtksh.sgml doc/src/sgml/ref/postgres-ref.sgml doc/src/sgml/ref/postmaster.sgml doc/src/sgml/ref/psql-ref.sgml doc/src/sgml/ref/reindex.sgml doc/src/sgml/ref/reset.sgml doc/src/sgml/ref/revoke.sgml doc/src/sgml/ref/rollback.sgml doc/src/sgml/ref/select.sgml doc/src/sgml/ref/select_into.sgml doc/src/sgml/ref/set.sgml doc/src/sgml/ref/set_constraints.sgml doc/src/sgml/ref/set_session_auth.sgml doc/src/sgml/ref/set_transaction.sgml doc/src/sgml/ref/show.sgml doc/src/sgml/ref/truncate.sgml doc/src/sgml/ref/unlisten.sgml doc/src/sgml/ref/update.sgml doc/src/sgml/ref/vacuum.sgml doc/src/sgml/ref/vacuumdb.sgml doc/src/sgml/refentry.sgml doc/src/sgml/reference.ced doc/src/sgml/reference.sgml doc/src/sgml/regress.sgml doc/src/sgml/release.sgml doc/src/sgml/rules.sgml doc/src/sgml/runtime.sgml doc/src/sgml/sources.sgml doc/src/sgml/spi.sgml doc/src/sgml/sql.sgml doc/src/sgml/standalone-install.sgml doc/src/sgml/start.sgml doc/src/sgml/stylesheet.css doc/src/sgml/stylesheet.dsl doc/src/sgml/syntax.sgml doc/src/sgml/trigger.sgml doc/src/sgml/tutorial.sgml doc/src/sgml/typeconv.sgml doc/src/sgml/user-manag.sgml doc/src/sgml/user.sgml doc/src/sgml/version.sgml doc/src/sgml/wal.sgml doc/src/sgml/xaggr.sgml doc/src/sgml/xfunc.sgml doc/src/sgml/xindex.sgml doc/src/sgml/xoper.sgml doc/src/sgml/xplang.sgml doc/src/sgml/xtypes.sgml doc/src/sgml/y2k.sgml register.txt src/DEVELOPERS src/Makefile src/Makefile.global.in src/Makefile.shlib src/backend/Makefile src/backend/access/Makefile src/backend/access/common/Makefile src/backend/access/common/heaptuple.c src/backend/access/common/indextuple.c src/backend/access/common/indexvalid.c src/backend/access/common/printtup.c src/backend/access/common/scankey.c src/backend/access/common/tupdesc.c src/backend/access/gist/Makefile src/backend/access/gist/gist.c src/backend/access/gist/gistget.c src/backend/access/gist/gistscan.c src/backend/access/gist/giststrat.c src/backend/access/hash/Makefile src/backend/access/hash/hash.c src/backend/access/hash/hashfunc.c src/backend/access/hash/hashinsert.c src/backend/access/hash/hashovfl.c src/backend/access/hash/hashpage.c src/backend/access/hash/hashscan.c src/backend/access/hash/hashsearch.c src/backend/access/hash/hashstrat.c src/backend/access/hash/hashutil.c src/backend/access/heap/Makefile src/backend/access/heap/heapam.c src/backend/access/heap/hio.c src/backend/access/heap/tuptoaster.c src/backend/access/index/Makefile src/backend/access/index/genam.c src/backend/access/index/indexam.c src/backend/access/index/istrat.c src/backend/access/nbtree/Makefile src/backend/access/nbtree/README src/backend/access/nbtree/nbtcompare.c src/backend/access/nbtree/nbtinsert.c src/backend/access/nbtree/nbtpage.c src/backend/access/nbtree/nbtree.c src/backend/access/nbtree/nbtsearch.c src/backend/access/nbtree/nbtsort.c src/backend/access/nbtree/nbtstrat.c src/backend/access/nbtree/nbtutils.c src/backend/access/rtree/Makefile src/backend/access/rtree/rtget.c src/backend/access/rtree/rtproc.c src/backend/access/rtree/rtree.c src/backend/access/rtree/rtscan.c src/backend/access/rtree/rtstrat.c src/backend/access/transam/Makefile src/backend/access/transam/clog.c src/backend/access/transam/rmgr.c src/backend/access/transam/transam.c src/backend/access/transam/varsup.c src/backend/access/transam/xact.c src/backend/access/transam/xid.c src/backend/access/transam/xlog.c src/backend/access/transam/xlogutils.c src/backend/bootstrap/.cvsignore src/backend/bootstrap/Makefile src/backend/bootstrap/bootparse.y src/backend/bootstrap/bootscanner.l src/backend/bootstrap/bootstrap.c src/backend/catalog/Makefile src/backend/catalog/README src/backend/catalog/aclchk.c src/backend/catalog/catalog.c src/backend/catalog/genbki.sh src/backend/catalog/heap.c src/backend/catalog/index.c src/backend/catalog/indexing.c src/backend/catalog/namespace.c src/backend/catalog/pg_aggregate.c src/backend/catalog/pg_largeobject.c src/backend/catalog/pg_namespace.c src/backend/catalog/pg_operator.c src/backend/catalog/pg_proc.c src/backend/catalog/pg_type.c src/backend/commands/Makefile src/backend/commands/_deadcode/recipe.c src/backend/commands/_deadcode/recipe.h src/backend/commands/_deadcode/version.c src/backend/commands/aggregatecmds.c src/backend/commands/analyze.c src/backend/commands/async.c src/backend/commands/cluster.c src/backend/commands/comment.c src/backend/commands/copy.c src/backend/commands/dbcommands.c src/backend/commands/define.c src/backend/commands/explain.c src/backend/commands/functioncmds.c src/backend/commands/indexcmds.c src/backend/commands/lockcmds.c src/backend/commands/operatorcmds.c src/backend/commands/portalcmds.c src/backend/commands/proclang.c src/backend/commands/schemacmds.c src/backend/commands/sequence.c src/backend/commands/tablecmds.c src/backend/commands/trigger.c src/backend/commands/typecmds.c src/backend/commands/user.c src/backend/commands/vacuum.c src/backend/commands/vacuumlazy.c src/backend/commands/variable.c src/backend/commands/view.c src/backend/executor/Makefile src/backend/executor/README src/backend/executor/_deadcode/nodeTee.c src/backend/executor/execAmi.c src/backend/executor/execJunk.c src/backend/executor/execMain.c src/backend/executor/execProcnode.c src/backend/executor/execQual.c src/backend/executor/execScan.c src/backend/executor/execTuples.c src/backend/executor/execUtils.c src/backend/executor/functions.c src/backend/executor/instrument.c src/backend/executor/nodeAgg.c src/backend/executor/nodeAppend.c src/backend/executor/nodeFunctionscan.c src/backend/executor/nodeGroup.c src/backend/executor/nodeHash.c src/backend/executor/nodeHashjoin.c src/backend/executor/nodeIndexscan.c src/backend/executor/nodeLimit.c src/backend/executor/nodeMaterial.c src/backend/executor/nodeMergejoin.c src/backend/executor/nodeNestloop.c src/backend/executor/nodeResult.c src/backend/executor/nodeSeqscan.c src/backend/executor/nodeSetOp.c src/backend/executor/nodeSort.c src/backend/executor/nodeSubplan.c src/backend/executor/nodeSubqueryscan.c src/backend/executor/nodeTidscan.c src/backend/executor/nodeUnique.c src/backend/executor/spi.c src/backend/lib/Makefile src/backend/lib/bit.c src/backend/lib/dllist.c src/backend/lib/lispsort.c src/backend/lib/stringinfo.c src/backend/libpq/Makefile src/backend/libpq/README.SSL src/backend/libpq/auth.c src/backend/libpq/be-fsstubs.c src/backend/libpq/be-secure.c src/backend/libpq/crypt.c src/backend/libpq/hba.c src/backend/libpq/md5.c src/backend/libpq/pg_hba.conf.sample src/backend/libpq/pg_ident.conf.sample src/backend/libpq/pqcomm.c src/backend/libpq/pqformat.c src/backend/libpq/pqsignal.c src/backend/main/Makefile src/backend/main/main.c src/backend/nodes/Makefile src/backend/nodes/README src/backend/nodes/copyfuncs.c src/backend/nodes/equalfuncs.c src/backend/nodes/list.c src/backend/nodes/makefuncs.c src/backend/nodes/nodeFuncs.c src/backend/nodes/nodes.c src/backend/nodes/outfuncs.c src/backend/nodes/print.c src/backend/nodes/read.c src/backend/nodes/readfuncs.c src/backend/optimizer/Makefile src/backend/optimizer/README src/backend/optimizer/geqo/Makefile src/backend/optimizer/geqo/geqo_copy.c src/backend/optimizer/geqo/geqo_cx.c src/backend/optimizer/geqo/geqo_erx.c src/backend/optimizer/geqo/geqo_eval.c src/backend/optimizer/geqo/geqo_main.c src/backend/optimizer/geqo/geqo_misc.c src/backend/optimizer/geqo/geqo_mutation.c src/backend/optimizer/geqo/geqo_ox1.c src/backend/optimizer/geqo/geqo_ox2.c src/backend/optimizer/geqo/geqo_pmx.c src/backend/optimizer/geqo/geqo_pool.c src/backend/optimizer/geqo/geqo_px.c src/backend/optimizer/geqo/geqo_recombination.c src/backend/optimizer/geqo/geqo_selection.c src/backend/optimizer/path/Makefile src/backend/optimizer/path/_deadcode/predmig.c src/backend/optimizer/path/_deadcode/xfunc.c src/backend/optimizer/path/allpaths.c src/backend/optimizer/path/clausesel.c src/backend/optimizer/path/costsize.c src/backend/optimizer/path/indxpath.c src/backend/optimizer/path/joinpath.c src/backend/optimizer/path/joinrels.c src/backend/optimizer/path/orindxpath.c src/backend/optimizer/path/pathkeys.c src/backend/optimizer/path/tidpath.c src/backend/optimizer/plan/Makefile src/backend/optimizer/plan/README src/backend/optimizer/plan/createplan.c src/backend/optimizer/plan/initsplan.c src/backend/optimizer/plan/planmain.c src/backend/optimizer/plan/planner.c src/backend/optimizer/plan/setrefs.c src/backend/optimizer/plan/subselect.c src/backend/optimizer/prep/Makefile src/backend/optimizer/prep/_deadcode/prepkeyset.c src/backend/optimizer/prep/prepqual.c src/backend/optimizer/prep/preptlist.c src/backend/optimizer/prep/prepunion.c src/backend/optimizer/util/Makefile src/backend/optimizer/util/clauses.c src/backend/optimizer/util/joininfo.c src/backend/optimizer/util/pathnode.c src/backend/optimizer/util/plancat.c src/backend/optimizer/util/relnode.c src/backend/optimizer/util/restrictinfo.c src/backend/optimizer/util/tlist.c src/backend/optimizer/util/var.c src/backend/parser/.cvsignore src/backend/parser/Makefile src/backend/parser/README src/backend/parser/analyze.c src/backend/parser/gram.y src/backend/parser/keywords.c src/backend/parser/parse_agg.c src/backend/parser/parse_clause.c src/backend/parser/parse_coerce.c src/backend/parser/parse_expr.c src/backend/parser/parse_func.c src/backend/parser/parse_node.c src/backend/parser/parse_oper.c src/backend/parser/parse_relation.c src/backend/parser/parse_target.c src/backend/parser/parse_type.c src/backend/parser/parser.c src/backend/parser/scan.l src/backend/parser/scansup.c src/backend/po/Makefile src/backend/po/cs.po src/backend/po/de.po src/backend/po/hu.po src/backend/po/nls.mk src/backend/po/ru.po src/backend/po/zh_CN.po src/backend/po/zh_TW.po src/backend/port/Makefile src/backend/port/aix/mkldexport.sh src/backend/port/beos/Makefile src/backend/port/beos/sem.c src/backend/port/beos/shm.c src/backend/port/beos/support.c src/backend/port/darwin/Makefile src/backend/port/darwin/README src/backend/port/darwin/system.c src/backend/port/dynloader/README.dlfcn.aix src/backend/port/dynloader/aix.c src/backend/port/dynloader/aix.h src/backend/port/dynloader/beos.c src/backend/port/dynloader/beos.h src/backend/port/dynloader/bsdi.c src/backend/port/dynloader/bsdi.h src/backend/port/dynloader/darwin.c src/backend/port/dynloader/darwin.h src/backend/port/dynloader/dgux.c src/backend/port/dynloader/dgux.h src/backend/port/dynloader/freebsd.c src/backend/port/dynloader/freebsd.h src/backend/port/dynloader/hpux.c src/backend/port/dynloader/hpux.h src/backend/port/dynloader/irix5.c src/backend/port/dynloader/irix5.h src/backend/port/dynloader/linux.c src/backend/port/dynloader/linux.h src/backend/port/dynloader/netbsd.c src/backend/port/dynloader/netbsd.h src/backend/port/dynloader/nextstep.c src/backend/port/dynloader/nextstep.h src/backend/port/dynloader/openbsd.c src/backend/port/dynloader/openbsd.h src/backend/port/dynloader/osf.c src/backend/port/dynloader/osf.h src/backend/port/dynloader/qnx4.c src/backend/port/dynloader/qnx4.h src/backend/port/dynloader/sco.c src/backend/port/dynloader/sco.h src/backend/port/dynloader/solaris.c src/backend/port/dynloader/solaris.h src/backend/port/dynloader/sunos4.c src/backend/port/dynloader/sunos4.h src/backend/port/dynloader/svr4.c src/backend/port/dynloader/svr4.h src/backend/port/dynloader/ultrix4.c src/backend/port/dynloader/ultrix4.h src/backend/port/dynloader/univel.c src/backend/port/dynloader/univel.h src/backend/port/dynloader/unixware.c src/backend/port/dynloader/unixware.h src/backend/port/dynloader/win.c src/backend/port/dynloader/win.h src/backend/port/gethostname.c src/backend/port/getrusage.c src/backend/port/hpux/tas.c.template src/backend/port/inet_aton.c src/backend/port/inet_aton.h src/backend/port/ipc_test.c src/backend/port/isinf.c src/backend/port/memcmp.c src/backend/port/nextstep/Makefile src/backend/port/nextstep/port.c src/backend/port/posix_sema.c src/backend/port/qnx4/Makefile src/backend/port/qnx4/ipc.h src/backend/port/qnx4/isnan.c src/backend/port/qnx4/rint.c src/backend/port/qnx4/sem.c src/backend/port/qnx4/sem.h src/backend/port/qnx4/shm.c src/backend/port/qnx4/shm.h src/backend/port/qnx4/tstrint.c src/backend/port/qnx4/tstsem.c src/backend/port/qnx4/tstshm.c src/backend/port/random.c src/backend/port/snprintf.c src/backend/port/srandom.c src/backend/port/strcasecmp.c src/backend/port/strerror.c src/backend/port/strtol.c src/backend/port/strtoul.c src/backend/port/sunos4/Makefile src/backend/port/sunos4/float.h src/backend/port/sysv_sema.c src/backend/port/sysv_shmem.c src/backend/port/tas/dummy.s src/backend/port/tas/hpux.s src/backend/port/tas/solaris_i386.s src/backend/port/tas/solaris_sparc.s src/backend/postmaster/Makefile src/backend/postmaster/pgstat.c src/backend/postmaster/postmaster.c src/backend/regex/COPYRIGHT src/backend/regex/Makefile src/backend/regex/WHATSNEW src/backend/regex/engine.c src/backend/regex/re_format.7 src/backend/regex/regcomp.c src/backend/regex/regerror.c src/backend/regex/regex.3 src/backend/regex/regexec.c src/backend/regex/regfree.c src/backend/regex/retest.c src/backend/rewrite/Makefile src/backend/rewrite/rewriteDefine.c src/backend/rewrite/rewriteHandler.c src/backend/rewrite/rewriteManip.c src/backend/rewrite/rewriteRemove.c src/backend/rewrite/rewriteSupport.c src/backend/storage/Makefile src/backend/storage/buffer/Makefile src/backend/storage/buffer/README src/backend/storage/buffer/buf_init.c src/backend/storage/buffer/buf_table.c src/backend/storage/buffer/bufmgr.c src/backend/storage/buffer/freelist.c src/backend/storage/buffer/localbuf.c src/backend/storage/file/Makefile src/backend/storage/file/buffile.c src/backend/storage/file/fd.c src/backend/storage/freespace/Makefile src/backend/storage/freespace/freespace.c src/backend/storage/ipc/Makefile src/backend/storage/ipc/README src/backend/storage/ipc/ipc.c src/backend/storage/ipc/ipci.c src/backend/storage/ipc/pmsignal.c src/backend/storage/ipc/shmem.c src/backend/storage/ipc/shmqueue.c src/backend/storage/ipc/sinval.c src/backend/storage/ipc/sinvaladt.c src/backend/storage/large_object/Makefile src/backend/storage/large_object/inv_api.c src/backend/storage/lmgr/Makefile src/backend/storage/lmgr/README src/backend/storage/lmgr/deadlock.c src/backend/storage/lmgr/lmgr.c src/backend/storage/lmgr/lock.c src/backend/storage/lmgr/lwlock.c src/backend/storage/lmgr/proc.c src/backend/storage/lmgr/s_lock.c src/backend/storage/lmgr/spin.c src/backend/storage/page/Makefile src/backend/storage/page/bufpage.c src/backend/storage/page/itemptr.c src/backend/storage/smgr/Makefile src/backend/storage/smgr/README src/backend/storage/smgr/md.c src/backend/storage/smgr/mm.c src/backend/storage/smgr/smgr.c src/backend/storage/smgr/smgrtype.c src/backend/tcop/Makefile src/backend/tcop/dest.c src/backend/tcop/fastpath.c src/backend/tcop/postgres.c src/backend/tcop/pquery.c src/backend/tcop/utility.c src/backend/tioga/Arr_TgRecipe.h src/backend/tioga/Makefile src/backend/tioga/Varray.c src/backend/tioga/Varray.h src/backend/tioga/tgRecipe.c src/backend/tioga/tgRecipe.h src/backend/utils/.cvsignore src/backend/utils/Gen_fmgrtab.sh src/backend/utils/Makefile src/backend/utils/adt/Makefile src/backend/utils/adt/acl.c src/backend/utils/adt/arrayfuncs.c src/backend/utils/adt/arrayutils.c src/backend/utils/adt/ascii.c src/backend/utils/adt/bool.c src/backend/utils/adt/cash.c src/backend/utils/adt/char.c src/backend/utils/adt/date.c src/backend/utils/adt/datetime.c src/backend/utils/adt/datum.c src/backend/utils/adt/encode.c src/backend/utils/adt/float.c src/backend/utils/adt/format_type.c src/backend/utils/adt/formatting.c src/backend/utils/adt/geo_ops.c src/backend/utils/adt/geo_selfuncs.c src/backend/utils/adt/inet_net_ntop.c src/backend/utils/adt/inet_net_pton.c src/backend/utils/adt/int.c src/backend/utils/adt/int8.c src/backend/utils/adt/like.c src/backend/utils/adt/like_match.c src/backend/utils/adt/mac.c src/backend/utils/adt/misc.c src/backend/utils/adt/nabstime.c src/backend/utils/adt/name.c src/backend/utils/adt/network.c src/backend/utils/adt/not_in.c src/backend/utils/adt/numeric.c src/backend/utils/adt/numutils.c src/backend/utils/adt/oid.c src/backend/utils/adt/oracle_compat.c src/backend/utils/adt/pg_locale.c src/backend/utils/adt/pg_lzcompress.c src/backend/utils/adt/pgstatfuncs.c src/backend/utils/adt/quote.c src/backend/utils/adt/regexp.c src/backend/utils/adt/regproc.c src/backend/utils/adt/ri_triggers.c src/backend/utils/adt/ruleutils.c src/backend/utils/adt/selfuncs.c src/backend/utils/adt/sets.c src/backend/utils/adt/tid.c src/backend/utils/adt/timestamp.c src/backend/utils/adt/varbit.c src/backend/utils/adt/varchar.c src/backend/utils/adt/varlena.c src/backend/utils/adt/version.c src/backend/utils/cache/Makefile src/backend/utils/cache/catcache.c src/backend/utils/cache/fcache.c src/backend/utils/cache/inval.c src/backend/utils/cache/lsyscache.c src/backend/utils/cache/relcache.c src/backend/utils/cache/syscache.c src/backend/utils/error/Makefile src/backend/utils/error/assert.c src/backend/utils/error/elog.c src/backend/utils/error/exc.c src/backend/utils/error/excabort.c src/backend/utils/error/excid.c src/backend/utils/error/format.c src/backend/utils/fmgr/Makefile src/backend/utils/fmgr/README src/backend/utils/fmgr/dfmgr.c src/backend/utils/fmgr/fmgr.c src/backend/utils/hash/Makefile src/backend/utils/hash/dynahash.c src/backend/utils/hash/hashfn.c src/backend/utils/hash/pg_crc.c src/backend/utils/init/Makefile src/backend/utils/init/findbe.c src/backend/utils/init/globals.c src/backend/utils/init/miscinit.c src/backend/utils/init/postinit.c src/backend/utils/mb/Makefile src/backend/utils/mb/README src/backend/utils/mb/Unicode/ISO10646-GB18030.TXT src/backend/utils/mb/Unicode/Makefile src/backend/utils/mb/Unicode/UCS_to_8859.pl src/backend/utils/mb/Unicode/UCS_to_BIG5.pl src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl src/backend/utils/mb/Unicode/UCS_to_GB18030.pl src/backend/utils/mb/Unicode/UCS_to_GBK.pl src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl src/backend/utils/mb/Unicode/UCS_to_SJIS.pl src/backend/utils/mb/Unicode/UCS_to_UHC.pl src/backend/utils/mb/Unicode/UCS_to_WIN874.pl src/backend/utils/mb/Unicode/UCS_to_WINX.pl src/backend/utils/mb/Unicode/UCS_to_cyrillic.pl src/backend/utils/mb/Unicode/alt_to_utf8.map src/backend/utils/mb/Unicode/big5_to_utf8.map src/backend/utils/mb/Unicode/euc_cn_to_utf8.map src/backend/utils/mb/Unicode/euc_jp_to_utf8.map src/backend/utils/mb/Unicode/euc_kr_to_utf8.map src/backend/utils/mb/Unicode/euc_tw_to_utf8.map src/backend/utils/mb/Unicode/gb18030_to_utf8.map src/backend/utils/mb/Unicode/gbk_to_utf8.map src/backend/utils/mb/Unicode/iso8859_10_to_utf8.map src/backend/utils/mb/Unicode/iso8859_13_to_utf8.map src/backend/utils/mb/Unicode/iso8859_14_to_utf8.map src/backend/utils/mb/Unicode/iso8859_15_to_utf8.map src/backend/utils/mb/Unicode/iso8859_16_to_utf8.map src/backend/utils/mb/Unicode/iso8859_2_to_utf8.map src/backend/utils/mb/Unicode/iso8859_3_to_utf8.map src/backend/utils/mb/Unicode/iso8859_4_to_utf8.map src/backend/utils/mb/Unicode/iso8859_5_to_utf8.map src/backend/utils/mb/Unicode/iso8859_6_to_utf8.map src/backend/utils/mb/Unicode/iso8859_7_to_utf8.map src/backend/utils/mb/Unicode/iso8859_8_to_utf8.map src/backend/utils/mb/Unicode/iso8859_9_to_utf8.map src/backend/utils/mb/Unicode/johab_to_utf8.map src/backend/utils/mb/Unicode/koi8r_to_utf8.map src/backend/utils/mb/Unicode/sjis_to_utf8.map src/backend/utils/mb/Unicode/tcvn_to_utf8.map src/backend/utils/mb/Unicode/ucs2utf.pl src/backend/utils/mb/Unicode/uhc_to_utf8.map src/backend/utils/mb/Unicode/utf8_to_alt.map src/backend/utils/mb/Unicode/utf8_to_big5.map src/backend/utils/mb/Unicode/utf8_to_euc_cn.map src/backend/utils/mb/Unicode/utf8_to_euc_jp.map src/backend/utils/mb/Unicode/utf8_to_euc_kr.map src/backend/utils/mb/Unicode/utf8_to_euc_tw.map src/backend/utils/mb/Unicode/utf8_to_gb18030.map src/backend/utils/mb/Unicode/utf8_to_gbk.map src/backend/utils/mb/Unicode/utf8_to_iso8859_10.map src/backend/utils/mb/Unicode/utf8_to_iso8859_13.map src/backend/utils/mb/Unicode/utf8_to_iso8859_14.map src/backend/utils/mb/Unicode/utf8_to_iso8859_15.map src/backend/utils/mb/Unicode/utf8_to_iso8859_16.map src/backend/utils/mb/Unicode/utf8_to_iso8859_2.map src/backend/utils/mb/Unicode/utf8_to_iso8859_3.map src/backend/utils/mb/Unicode/utf8_to_iso8859_4.map src/backend/utils/mb/Unicode/utf8_to_iso8859_5.map src/backend/utils/mb/Unicode/utf8_to_iso8859_6.map src/backend/utils/mb/Unicode/utf8_to_iso8859_7.map src/backend/utils/mb/Unicode/utf8_to_iso8859_8.map src/backend/utils/mb/Unicode/utf8_to_iso8859_9.map src/backend/utils/mb/Unicode/utf8_to_johab.map src/backend/utils/mb/Unicode/utf8_to_koi8r.map src/backend/utils/mb/Unicode/utf8_to_sjis.map src/backend/utils/mb/Unicode/utf8_to_tcvn.map src/backend/utils/mb/Unicode/utf8_to_uhc.map src/backend/utils/mb/Unicode/utf8_to_win1250.map src/backend/utils/mb/Unicode/utf8_to_win1251.map src/backend/utils/mb/Unicode/utf8_to_win1256.map src/backend/utils/mb/Unicode/utf8_to_win874.map src/backend/utils/mb/Unicode/win1250_to_utf8.map src/backend/utils/mb/Unicode/win1251_to_utf8.map src/backend/utils/mb/Unicode/win1256_to_utf8.map src/backend/utils/mb/Unicode/win874_to_utf8.map src/backend/utils/mb/alt.c src/backend/utils/mb/big5.c src/backend/utils/mb/conv.c src/backend/utils/mb/encnames.c src/backend/utils/mb/iso.c src/backend/utils/mb/mbutils.c src/backend/utils/mb/sjis.map src/backend/utils/mb/wchar.c src/backend/utils/mb/win.c src/backend/utils/mb/win1251.c src/backend/utils/mb/wstrcmp.c src/backend/utils/mb/wstrncmp.c src/backend/utils/misc/.cvsignore src/backend/utils/misc/Makefile src/backend/utils/misc/README src/backend/utils/misc/database.c src/backend/utils/misc/guc-file.l src/backend/utils/misc/guc.c src/backend/utils/misc/postgresql.conf.sample src/backend/utils/misc/ps_status.c src/backend/utils/misc/superuser.c src/backend/utils/mmgr/Makefile src/backend/utils/mmgr/README src/backend/utils/mmgr/aset.c src/backend/utils/mmgr/mcxt.c src/backend/utils/mmgr/portalmem.c src/backend/utils/sort/Makefile src/backend/utils/sort/logtape.c src/backend/utils/sort/tuplesort.c src/backend/utils/sort/tuplestore.c src/backend/utils/time/Makefile src/backend/utils/time/tqual.c src/bin/Makefile src/bin/initdb/Makefile src/bin/initdb/initdb.sh src/bin/initlocation/Makefile src/bin/initlocation/initlocation.sh src/bin/ipcclean/Makefile src/bin/ipcclean/ipcclean.sh src/bin/pg_config/Makefile src/bin/pg_config/pg_config.sh src/bin/pg_ctl/Makefile src/bin/pg_ctl/pg_ctl.sh src/bin/pg_dump/Makefile src/bin/pg_dump/README src/bin/pg_dump/common.c src/bin/pg_dump/cs.po src/bin/pg_dump/de.po src/bin/pg_dump/nls.mk src/bin/pg_dump/pg_backup.h src/bin/pg_dump/pg_backup_archiver.c src/bin/pg_dump/pg_backup_archiver.h src/bin/pg_dump/pg_backup_custom.c src/bin/pg_dump/pg_backup_db.c src/bin/pg_dump/pg_backup_db.h src/bin/pg_dump/pg_backup_files.c src/bin/pg_dump/pg_backup_null.c src/bin/pg_dump/pg_backup_tar.c src/bin/pg_dump/pg_backup_tar.h src/bin/pg_dump/pg_dump.c src/bin/pg_dump/pg_dump.h src/bin/pg_dump/pg_dumpall.sh src/bin/pg_dump/pg_restore.c src/bin/pg_dump/ru.po src/bin/pg_dump/sv.po src/bin/pg_dump/zh_CN.po src/bin/pg_dump/zh_TW.po src/bin/pg_encoding/Makefile src/bin/pg_encoding/pg_encoding.c src/bin/pg_id/Makefile src/bin/pg_id/pg_id.c src/bin/pgaccess/Makefile src/bin/pgaccess/README src/bin/pgaccess/copyright.html src/bin/pgaccess/demo/formdemo.sql src/bin/pgaccess/doc/html/a_right.gif src/bin/pgaccess/doc/html/addindex.gif src/bin/pgaccess/doc/html/api.html src/bin/pgaccess/doc/html/ball.gif src/bin/pgaccess/doc/html/contents.html src/bin/pgaccess/doc/html/copyright.html src/bin/pgaccess/doc/html/documentation.html src/bin/pgaccess/doc/html/download.html src/bin/pgaccess/doc/html/faq.html src/bin/pgaccess/doc/html/features.html src/bin/pgaccess/doc/html/formdemo.sql src/bin/pgaccess/doc/html/forms.gif src/bin/pgaccess/doc/html/forms.html src/bin/pgaccess/doc/html/function.gif src/bin/pgaccess/doc/html/help.gif src/bin/pgaccess/doc/html/index.html src/bin/pgaccess/doc/html/irix.html src/bin/pgaccess/doc/html/linux1.gif src/bin/pgaccess/doc/html/maillist.html src/bin/pgaccess/doc/html/main.html src/bin/pgaccess/doc/html/mainwindow.gif src/bin/pgaccess/doc/html/newtable.gif src/bin/pgaccess/doc/html/newuser.gif src/bin/pgaccess/doc/html/old_index.html src/bin/pgaccess/doc/html/permissions.gif src/bin/pgaccess/doc/html/pg93patch.html src/bin/pgaccess/doc/html/pga-rad.html src/bin/pgaccess/doc/html/qbtclet.html src/bin/pgaccess/doc/html/qbtclet.tcl src/bin/pgaccess/doc/html/screenshots.html src/bin/pgaccess/doc/html/specialchars.html src/bin/pgaccess/doc/html/todo.html src/bin/pgaccess/doc/html/tutorial/addref.jpg src/bin/pgaccess/doc/html/tutorial/altern_q.jpg src/bin/pgaccess/doc/html/tutorial/altern_v.jpg src/bin/pgaccess/doc/html/tutorial/copyright.html src/bin/pgaccess/doc/html/tutorial/index.html src/bin/pgaccess/doc/html/tutorial/intro.html src/bin/pgaccess/doc/html/tutorial/irix.html src/bin/pgaccess/doc/html/tutorial/newref.txt src/bin/pgaccess/doc/html/tutorial/newtable.jpg src/bin/pgaccess/doc/html/tutorial/newtable.tga src/bin/pgaccess/doc/html/tutorial/problems.html src/bin/pgaccess/doc/html/tutorial/screen1.jpg src/bin/pgaccess/doc/html/tutorial/sel_tbl.jpg src/bin/pgaccess/doc/html/tutorial/start.html src/bin/pgaccess/doc/html/tutorial/tut.html src/bin/pgaccess/doc/html/tutorial/tut_edit.html src/bin/pgaccess/doc/html/tutorial/tut_new.html src/bin/pgaccess/doc/html/tutorial/tut_sel1.html src/bin/pgaccess/doc/html/tutorial/tut_user.html src/bin/pgaccess/doc/html/vdesigner.gif src/bin/pgaccess/doc/html/whatsnew.html src/bin/pgaccess/doc/html/win32.html src/bin/pgaccess/images/icon_button.gif src/bin/pgaccess/images/icon_checkbutton.gif src/bin/pgaccess/images/icon_entry.gif src/bin/pgaccess/images/icon_frame.gif src/bin/pgaccess/images/icon_label.gif src/bin/pgaccess/images/icon_listbox.gif src/bin/pgaccess/images/icon_query.gif src/bin/pgaccess/images/icon_radiobutton.gif src/bin/pgaccess/images/icon_text.gif src/bin/pgaccess/lib/database.tcl src/bin/pgaccess/lib/forms.tcl src/bin/pgaccess/lib/functions.tcl src/bin/pgaccess/lib/help/abort.hlp src/bin/pgaccess/lib/help/add_records.hlp src/bin/pgaccess/lib/help/alter_table.hlp src/bin/pgaccess/lib/help/alter_user.hlp src/bin/pgaccess/lib/help/author.hlp src/bin/pgaccess/lib/help/begin.hlp src/bin/pgaccess/lib/help/close.hlp src/bin/pgaccess/lib/help/cluster.hlp src/bin/pgaccess/lib/help/commit.hlp src/bin/pgaccess/lib/help/copy.hlp src/bin/pgaccess/lib/help/copyrights.hlp src/bin/pgaccess/lib/help/create_aggregate.hlp src/bin/pgaccess/lib/help/create_database.hlp src/bin/pgaccess/lib/help/create_function.hlp src/bin/pgaccess/lib/help/create_index.hlp src/bin/pgaccess/lib/help/create_language.hlp src/bin/pgaccess/lib/help/create_operator.hlp src/bin/pgaccess/lib/help/create_rule.hlp src/bin/pgaccess/lib/help/create_sequence.hlp src/bin/pgaccess/lib/help/create_table.hlp src/bin/pgaccess/lib/help/create_table_as.hlp src/bin/pgaccess/lib/help/create_trigger.hlp src/bin/pgaccess/lib/help/create_type.hlp src/bin/pgaccess/lib/help/create_user.hlp src/bin/pgaccess/lib/help/create_view.hlp src/bin/pgaccess/lib/help/data_types.hlp src/bin/pgaccess/lib/help/datefunc.hlp src/bin/pgaccess/lib/help/declare.hlp src/bin/pgaccess/lib/help/delete.hlp src/bin/pgaccess/lib/help/drop_aggregate.hlp src/bin/pgaccess/lib/help/drop_database.hlp src/bin/pgaccess/lib/help/drop_function.hlp src/bin/pgaccess/lib/help/drop_index.hlp src/bin/pgaccess/lib/help/drop_language.hlp src/bin/pgaccess/lib/help/drop_operator.hlp src/bin/pgaccess/lib/help/drop_rule.hlp src/bin/pgaccess/lib/help/drop_sequence.hlp src/bin/pgaccess/lib/help/drop_table.hlp src/bin/pgaccess/lib/help/drop_trigger.hlp src/bin/pgaccess/lib/help/drop_type.hlp src/bin/pgaccess/lib/help/drop_user.hlp src/bin/pgaccess/lib/help/drop_view.hlp src/bin/pgaccess/lib/help/explain.hlp src/bin/pgaccess/lib/help/fetch.hlp src/bin/pgaccess/lib/help/form_design.hlp src/bin/pgaccess/lib/help/forms.hlp src/bin/pgaccess/lib/help/functions.hlp src/bin/pgaccess/lib/help/geomfunc.hlp src/bin/pgaccess/lib/help/grant.hlp src/bin/pgaccess/lib/help/history.hlp src/bin/pgaccess/lib/help/index.hlp src/bin/pgaccess/lib/help/inheritance.hlp src/bin/pgaccess/lib/help/insert.hlp src/bin/pgaccess/lib/help/ipv4func.hlp src/bin/pgaccess/lib/help/isolation.hlp src/bin/pgaccess/lib/help/keywords.hlp src/bin/pgaccess/lib/help/listen.hlp src/bin/pgaccess/lib/help/load.hlp src/bin/pgaccess/lib/help/lock.hlp src/bin/pgaccess/lib/help/mathfunc.hlp src/bin/pgaccess/lib/help/move.hlp src/bin/pgaccess/lib/help/mvcc.hlp src/bin/pgaccess/lib/help/new_query.hlp src/bin/pgaccess/lib/help/new_table.hlp src/bin/pgaccess/lib/help/notify.hlp src/bin/pgaccess/lib/help/open_query.hlp src/bin/pgaccess/lib/help/open_table.hlp src/bin/pgaccess/lib/help/pgfunctions.hlp src/bin/pgaccess/lib/help/postgresql.hlp src/bin/pgaccess/lib/help/queries.hlp src/bin/pgaccess/lib/help/reports.hlp src/bin/pgaccess/lib/help/reset.hlp src/bin/pgaccess/lib/help/revoke.hlp src/bin/pgaccess/lib/help/rollback.hlp src/bin/pgaccess/lib/help/schema.hlp src/bin/pgaccess/lib/help/scripts.hlp src/bin/pgaccess/lib/help/select.hlp src/bin/pgaccess/lib/help/select_into.hlp src/bin/pgaccess/lib/help/sequences.hlp src/bin/pgaccess/lib/help/set.hlp src/bin/pgaccess/lib/help/show.hlp src/bin/pgaccess/lib/help/sql_guide.hlp src/bin/pgaccess/lib/help/sqlfunc.hlp src/bin/pgaccess/lib/help/stringfunc.hlp src/bin/pgaccess/lib/help/tables.hlp src/bin/pgaccess/lib/help/unlisten.hlp src/bin/pgaccess/lib/help/update.hlp src/bin/pgaccess/lib/help/users.hlp src/bin/pgaccess/lib/help/vacuum.hlp src/bin/pgaccess/lib/help/view_table_structure.hlp src/bin/pgaccess/lib/help/views.hlp src/bin/pgaccess/lib/help/visual_designer.hlp src/bin/pgaccess/lib/help/y2k.hlp src/bin/pgaccess/lib/help.tcl src/bin/pgaccess/lib/languages/chinese_big5 src/bin/pgaccess/lib/languages/chinese_gb src/bin/pgaccess/lib/languages/czech src/bin/pgaccess/lib/languages/deutsch src/bin/pgaccess/lib/languages/euskara src/bin/pgaccess/lib/languages/francais src/bin/pgaccess/lib/languages/italiano src/bin/pgaccess/lib/languages/japanese src/bin/pgaccess/lib/languages/magyar src/bin/pgaccess/lib/languages/nederlands src/bin/pgaccess/lib/languages/portugues src/bin/pgaccess/lib/languages/romana src/bin/pgaccess/lib/languages/russian.koi8r src/bin/pgaccess/lib/languages/russian_win src/bin/pgaccess/lib/languages/spanish src/bin/pgaccess/lib/mainlib.tcl src/bin/pgaccess/lib/preferences.tcl src/bin/pgaccess/lib/queries.tcl src/bin/pgaccess/lib/reports.tcl src/bin/pgaccess/lib/schema.tcl src/bin/pgaccess/lib/scripts.tcl src/bin/pgaccess/lib/sequences.tcl src/bin/pgaccess/lib/tables.tcl src/bin/pgaccess/lib/users.tcl src/bin/pgaccess/lib/views.tcl src/bin/pgaccess/lib/visualqb.tcl src/bin/pgaccess/main.tcl src/bin/pgaccess/pgaccess.sh src/bin/pgtclsh/Makefile src/bin/pgtclsh/README src/bin/pgtclsh/pgtclAppInit.c src/bin/pgtclsh/pgtclUtils.tcl src/bin/pgtclsh/pgtkAppInit.c src/bin/pgtclsh/updateStats.tcl src/bin/psql/.cvsignore src/bin/psql/Makefile src/bin/psql/command.c src/bin/psql/command.h src/bin/psql/common.c src/bin/psql/common.h src/bin/psql/copy.c src/bin/psql/copy.h src/bin/psql/create_help.pl src/bin/psql/cs.po src/bin/psql/de.po src/bin/psql/describe.c src/bin/psql/describe.h src/bin/psql/fr.po src/bin/psql/help.c src/bin/psql/help.h src/bin/psql/input.c src/bin/psql/input.h src/bin/psql/large_obj.c src/bin/psql/large_obj.h src/bin/psql/mainloop.c src/bin/psql/mainloop.h src/bin/psql/mbprint.c src/bin/psql/mbprint.h src/bin/psql/nls.mk src/bin/psql/print.c src/bin/psql/print.h src/bin/psql/prompt.c src/bin/psql/prompt.h src/bin/psql/ru.po src/bin/psql/settings.h src/bin/psql/startup.c src/bin/psql/stringutils.c src/bin/psql/stringutils.h src/bin/psql/sv.po src/bin/psql/tab-complete.c src/bin/psql/tab-complete.h src/bin/psql/variables.c src/bin/psql/variables.h src/bin/psql/win32.mak src/bin/psql/zh_CN.po src/bin/psql/zh_TW.po src/bin/scripts/Makefile src/bin/scripts/createdb src/bin/scripts/createlang.sh src/bin/scripts/createuser src/bin/scripts/dropdb src/bin/scripts/droplang src/bin/scripts/dropuser src/bin/scripts/vacuumdb src/corba/CosQuery.idl src/corba/CosQueryCollection.idl src/corba/pgsql.idl src/corba/pgsql_int.idl src/corba/server.cc src/data/charset.conf src/data/isocz-wincz.tab src/data/koi-alt.tab src/data/koi-iso.tab src/data/koi-koi.tab src/data/koi-mac.tab src/data/koi-win.tab src/include/Makefile src/include/access/attnum.h src/include/access/clog.h src/include/access/genam.h src/include/access/gist.h src/include/access/gistscan.h src/include/access/hash.h src/include/access/heapam.h src/include/access/hio.h src/include/access/htup.h src/include/access/ibit.h src/include/access/iqual.h src/include/access/istrat.h src/include/access/itup.h src/include/access/nbtree.h src/include/access/printtup.h src/include/access/relscan.h src/include/access/rmgr.h src/include/access/rtree.h src/include/access/rtscan.h src/include/access/sdir.h src/include/access/skey.h src/include/access/strat.h src/include/access/transam.h src/include/access/tupdesc.h src/include/access/tupmacs.h src/include/access/tuptoaster.h src/include/access/valid.h src/include/access/xact.h src/include/access/xlog.h src/include/access/xlogdefs.h src/include/access/xlogutils.h src/include/bootstrap/bootstrap.h src/include/c.h src/include/catalog/catalog.h src/include/catalog/catname.h src/include/catalog/catversion.h src/include/catalog/duplicate_oids src/include/catalog/heap.h src/include/catalog/index.h src/include/catalog/indexing.h src/include/catalog/namespace.h src/include/catalog/pg_aggregate.h src/include/catalog/pg_am.h src/include/catalog/pg_amop.h src/include/catalog/pg_amproc.h src/include/catalog/pg_attrdef.h src/include/catalog/pg_attribute.h src/include/catalog/pg_class.h src/include/catalog/pg_control.h src/include/catalog/pg_database.h src/include/catalog/pg_description.h src/include/catalog/pg_group.h src/include/catalog/pg_index.h src/include/catalog/pg_inherits.h src/include/catalog/pg_language.h src/include/catalog/pg_largeobject.h src/include/catalog/pg_listener.h src/include/catalog/pg_namespace.h src/include/catalog/pg_opclass.h src/include/catalog/pg_operator.h src/include/catalog/pg_proc.h src/include/catalog/pg_relcheck.h src/include/catalog/pg_rewrite.h src/include/catalog/pg_shadow.h src/include/catalog/pg_statistic.h src/include/catalog/pg_trigger.h src/include/catalog/pg_type.h src/include/catalog/pg_version.h src/include/catalog/unused_oids src/include/commands/async.h src/include/commands/cluster.h src/include/commands/comment.h src/include/commands/copy.h src/include/commands/dbcommands.h src/include/commands/defrem.h src/include/commands/explain.h src/include/commands/lockcmds.h src/include/commands/portalcmds.h src/include/commands/proclang.h src/include/commands/schemacmds.h src/include/commands/sequence.h src/include/commands/tablecmds.h src/include/commands/trigger.h src/include/commands/user.h src/include/commands/vacuum.h src/include/commands/variable.h src/include/commands/version.h src/include/commands/view.h src/include/executor/execdebug.h src/include/executor/execdefs.h src/include/executor/execdesc.h src/include/executor/executor.h src/include/executor/functions.h src/include/executor/hashjoin.h src/include/executor/instrument.h src/include/executor/nodeAgg.h src/include/executor/nodeAppend.h src/include/executor/nodeFunctionscan.h src/include/executor/nodeGroup.h src/include/executor/nodeHash.h src/include/executor/nodeHashjoin.h src/include/executor/nodeIndexscan.h src/include/executor/nodeLimit.h src/include/executor/nodeMaterial.h src/include/executor/nodeMergejoin.h src/include/executor/nodeNestloop.h src/include/executor/nodeResult.h src/include/executor/nodeSeqscan.h src/include/executor/nodeSetOp.h src/include/executor/nodeSort.h src/include/executor/nodeSubplan.h src/include/executor/nodeSubqueryscan.h src/include/executor/nodeTidscan.h src/include/executor/nodeUnique.h src/include/executor/spi.h src/include/executor/spi_priv.h src/include/executor/tuptable.h src/include/fmgr.h src/include/lib/dllist.h src/include/lib/lispsort.h src/include/lib/stringinfo.h src/include/libpq/auth.h src/include/libpq/be-fsstubs.h src/include/libpq/crypt.h src/include/libpq/hba.h src/include/libpq/libpq-be.h src/include/libpq/libpq-fs.h src/include/libpq/libpq.h src/include/libpq/password.h src/include/libpq/pqcomm.h src/include/libpq/pqformat.h src/include/libpq/pqsignal.h src/include/mb/pg_wchar.h src/include/miscadmin.h src/include/nodes/execnodes.h src/include/nodes/makefuncs.h src/include/nodes/memnodes.h src/include/nodes/nodeFuncs.h src/include/nodes/nodes.h src/include/nodes/params.h src/include/nodes/parsenodes.h src/include/nodes/pg_list.h src/include/nodes/plannodes.h src/include/nodes/primnodes.h src/include/nodes/print.h src/include/nodes/readfuncs.h src/include/nodes/relation.h src/include/optimizer/_deadcode/xfunc.h src/include/optimizer/clauses.h src/include/optimizer/cost.h src/include/optimizer/geqo.h src/include/optimizer/geqo_copy.h src/include/optimizer/geqo_gene.h src/include/optimizer/geqo_misc.h src/include/optimizer/geqo_mutation.h src/include/optimizer/geqo_pool.h src/include/optimizer/geqo_random.h src/include/optimizer/geqo_recombination.h src/include/optimizer/geqo_selection.h src/include/optimizer/joininfo.h src/include/optimizer/pathnode.h src/include/optimizer/paths.h src/include/optimizer/plancat.h src/include/optimizer/planmain.h src/include/optimizer/planner.h src/include/optimizer/prep.h src/include/optimizer/restrictinfo.h src/include/optimizer/subselect.h src/include/optimizer/tlist.h src/include/optimizer/var.h src/include/parser/analyze.h src/include/parser/gramparse.h src/include/parser/keywords.h src/include/parser/parse_agg.h src/include/parser/parse_clause.h src/include/parser/parse_coerce.h src/include/parser/parse_expr.h src/include/parser/parse_func.h src/include/parser/parse_node.h src/include/parser/parse_oper.h src/include/parser/parse_relation.h src/include/parser/parse_target.h src/include/parser/parse_type.h src/include/parser/parser.h src/include/parser/parsetree.h src/include/parser/scansup.h src/include/pg_config.h.in src/include/pg_config.h.win32 src/include/pgstat.h src/include/port/aix.h src/include/port/beos.h src/include/port/bsdi.h src/include/port/darwin.h src/include/port/dgux.h src/include/port/freebsd.h src/include/port/hpux.h src/include/port/irix5.h src/include/port/linux.h src/include/port/netbsd.h src/include/port/nextstep.h src/include/port/openbsd.h src/include/port/osf.h src/include/port/qnx4.h src/include/port/sco.h src/include/port/solaris.h src/include/port/sunos4.h src/include/port/svr4.h src/include/port/ultrix4.h src/include/port/univel.h src/include/port/unixware.h src/include/port/win.h src/include/port/win32.h src/include/postgres.h src/include/postgres_ext.h src/include/postgres_fe.h src/include/regex/cclass.h src/include/regex/cname.h src/include/regex/regex.h src/include/regex/regex2.h src/include/regex/utils.h src/include/rewrite/prs2lock.h src/include/rewrite/rewriteDefine.h src/include/rewrite/rewriteHandler.h src/include/rewrite/rewriteManip.h src/include/rewrite/rewriteRemove.h src/include/rewrite/rewriteSupport.h src/include/rusagestub.h src/include/storage/backendid.h src/include/storage/block.h src/include/storage/buf.h src/include/storage/buf_internals.h src/include/storage/buffile.h src/include/storage/bufmgr.h src/include/storage/bufpage.h src/include/storage/fd.h src/include/storage/freespace.h src/include/storage/ipc.h src/include/storage/item.h src/include/storage/itemid.h src/include/storage/itempos.h src/include/storage/itemptr.h src/include/storage/large_object.h src/include/storage/lmgr.h src/include/storage/lock.h src/include/storage/lwlock.h src/include/storage/off.h src/include/storage/page.h src/include/storage/pg_sema.h src/include/storage/pg_shmem.h src/include/storage/pmsignal.h src/include/storage/pos.h src/include/storage/proc.h src/include/storage/relfilenode.h src/include/storage/s_lock.h src/include/storage/shmem.h src/include/storage/sinval.h src/include/storage/sinvaladt.h src/include/storage/smgr.h src/include/storage/spin.h src/include/strdup.h src/include/tcop/dest.h src/include/tcop/fastpath.h src/include/tcop/pquery.h src/include/tcop/tcopdebug.h src/include/tcop/tcopprot.h src/include/tcop/utility.h src/include/utils/acl.h src/include/utils/array.h src/include/utils/ascii.h src/include/utils/bit.h src/include/utils/builtins.h src/include/utils/cash.h src/include/utils/catcache.h src/include/utils/date.h src/include/utils/datetime.h src/include/utils/datum.h src/include/utils/dynahash.h src/include/utils/dynamic_loader.h src/include/utils/elog.h src/include/utils/exc.h src/include/utils/excid.h src/include/utils/fcache.h src/include/utils/fmgrtab.h src/include/utils/formatting.h src/include/utils/geo_decls.h src/include/utils/guc.h src/include/utils/hsearch.h src/include/utils/inet.h src/include/utils/int8.h src/include/utils/inval.h src/include/utils/logtape.h src/include/utils/lsyscache.h src/include/utils/memutils.h src/include/utils/nabstime.h src/include/utils/numeric.h src/include/utils/palloc.h src/include/utils/pg_crc.h src/include/utils/pg_locale.h src/include/utils/pg_lzcompress.h src/include/utils/portal.h src/include/utils/ps_status.h src/include/utils/rel.h src/include/utils/relcache.h src/include/utils/selfuncs.h src/include/utils/sets.h src/include/utils/syscache.h src/include/utils/timestamp.h src/include/utils/tqual.h src/include/utils/tuplesort.h src/include/utils/tuplestore.h src/include/utils/varbit.h src/interfaces/Makefile src/interfaces/cli/example1.c src/interfaces/cli/example2.c src/interfaces/cli/sqlcli.h src/interfaces/jdbc/CHANGELOG src/interfaces/jdbc/Implementation src/interfaces/jdbc/Makefile src/interfaces/jdbc/README src/interfaces/jdbc/build.xml src/interfaces/jdbc/example/ImageViewer.java src/interfaces/jdbc/example/Unicode.java src/interfaces/jdbc/example/basic.java src/interfaces/jdbc/example/blobtest.java src/interfaces/jdbc/example/corba/StockClient.java src/interfaces/jdbc/example/corba/StockDB.java src/interfaces/jdbc/example/corba/StockDispenserImpl.java src/interfaces/jdbc/example/corba/StockItemImpl.java src/interfaces/jdbc/example/corba/StockServer.java src/interfaces/jdbc/example/corba/readme src/interfaces/jdbc/example/corba/stock.idl src/interfaces/jdbc/example/corba/stock.sql src/interfaces/jdbc/example/datestyle.java src/interfaces/jdbc/example/metadata.java src/interfaces/jdbc/example/psql.java src/interfaces/jdbc/example/threadsafe.java src/interfaces/jdbc/jdbc.jpx src/interfaces/jdbc/org/postgresql/Connection.java src/interfaces/jdbc/org/postgresql/Driver.java.in src/interfaces/jdbc/org/postgresql/Field.java src/interfaces/jdbc/org/postgresql/PG_Stream.java src/interfaces/jdbc/org/postgresql/PostgresqlDataSource.java src/interfaces/jdbc/org/postgresql/ResultSet.java src/interfaces/jdbc/org/postgresql/Statement.java src/interfaces/jdbc/org/postgresql/core/BytePoolDim1.java src/interfaces/jdbc/org/postgresql/core/BytePoolDim2.java src/interfaces/jdbc/org/postgresql/core/Encoding.java src/interfaces/jdbc/org/postgresql/core/MemoryPool.java src/interfaces/jdbc/org/postgresql/core/ObjectPool.java src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java src/interfaces/jdbc/org/postgresql/core/SimpleObjectPool.java src/interfaces/jdbc/org/postgresql/core/StartupPacket.java src/interfaces/jdbc/org/postgresql/errors.properties src/interfaces/jdbc/org/postgresql/errors_de.properties src/interfaces/jdbc/org/postgresql/errors_fr.properties src/interfaces/jdbc/org/postgresql/errors_it.properties src/interfaces/jdbc/org/postgresql/errors_nl.properties src/interfaces/jdbc/org/postgresql/errors_zh_TW.properties src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java src/interfaces/jdbc/org/postgresql/fastpath/FastpathArg.java src/interfaces/jdbc/org/postgresql/geometric/PGbox.java src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java src/interfaces/jdbc/org/postgresql/geometric/PGline.java src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java src/interfaces/jdbc/org/postgresql/geometric/PGpath.java src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java src/interfaces/jdbc/org/postgresql/geometric/PGpolygon.java src/interfaces/jdbc/org/postgresql/jdbc1/CallableStatement.java src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java src/interfaces/jdbc/org/postgresql/jdbc1/ResultSetMetaData.java src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java src/interfaces/jdbc/org/postgresql/jdbc2/Array.java src/interfaces/jdbc/org/postgresql/jdbc2/CallableStatement.java src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java src/interfaces/jdbc/org/postgresql/jdbc2/PBatchUpdateException.java src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java src/interfaces/jdbc/org/postgresql/jdbc2/ResultSetMetaData.java src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java src/interfaces/jdbc/org/postgresql/jdbc2/UpdateableResultSet.java src/interfaces/jdbc/org/postgresql/largeobject/BlobInputStream.java src/interfaces/jdbc/org/postgresql/largeobject/BlobOutputStream.java src/interfaces/jdbc/org/postgresql/largeobject/LargeObject.java src/interfaces/jdbc/org/postgresql/largeobject/LargeObjectManager.java src/interfaces/jdbc/org/postgresql/largeobject/PGblob.java src/interfaces/jdbc/org/postgresql/largeobject/PGclob.java src/interfaces/jdbc/org/postgresql/test/JDBC2Tests.java src/interfaces/jdbc/org/postgresql/test/README src/interfaces/jdbc/org/postgresql/test/jdbc2/ANTTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/BatchExecuteTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/BlobTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/ConnectionTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/DateTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/DriverTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/EncodingTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/JBuilderTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/ResultSetTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/TimeTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/TimestampTest.java src/interfaces/jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java src/interfaces/jdbc/org/postgresql/util/MD5Digest.java src/interfaces/jdbc/org/postgresql/util/MessageTranslator.java src/interfaces/jdbc/org/postgresql/util/PGbytea.java src/interfaces/jdbc/org/postgresql/util/PGmoney.java src/interfaces/jdbc/org/postgresql/util/PGobject.java src/interfaces/jdbc/org/postgresql/util/PGtokenizer.java src/interfaces/jdbc/org/postgresql/util/PSQLException.java src/interfaces/jdbc/org/postgresql/util/Serialize.java src/interfaces/jdbc/org/postgresql/util/UnixCrypt.java src/interfaces/jdbc/org/postgresql/xa/ClientConnection.java src/interfaces/jdbc/org/postgresql/xa/TwoPhaseConnection.java src/interfaces/jdbc/org/postgresql/xa/TxConnection.java src/interfaces/jdbc/org/postgresql/xa/XAConnectionImpl.java src/interfaces/jdbc/org/postgresql/xa/XADataSourceImpl.java src/interfaces/jdbc/utils/CheckVersion.java src/interfaces/jdbc/utils/buildDriver src/interfaces/jdbc/utils/changelog.pl src/interfaces/libpgeasy/Makefile src/interfaces/libpgeasy/README src/interfaces/libpgeasy/examples/Makefile src/interfaces/libpgeasy/examples/pginsert.c src/interfaces/libpgeasy/examples/pgmultiresult.c src/interfaces/libpgeasy/examples/pgnulltest.c src/interfaces/libpgeasy/examples/pgwordcount.c src/interfaces/libpgeasy/halt.c src/interfaces/libpgeasy/halt.h src/interfaces/libpgeasy/libpgeasy.c src/interfaces/libpgeasy/libpgeasy.h src/interfaces/libpgtcl/Makefile src/interfaces/libpgtcl/README src/interfaces/libpgtcl/libpgtcl.def src/interfaces/libpgtcl/libpgtcl.h src/interfaces/libpgtcl/pgtcl.c src/interfaces/libpgtcl/pgtclCmds.c src/interfaces/libpgtcl/pgtclCmds.h src/interfaces/libpgtcl/pgtclId.c src/interfaces/libpgtcl/pgtclId.h src/interfaces/libpgtcl/win32.mak src/interfaces/libpq/Makefile src/interfaces/libpq/README src/interfaces/libpq/cs.po src/interfaces/libpq/de.po src/interfaces/libpq/fe-auth.c src/interfaces/libpq/fe-auth.h src/interfaces/libpq/fe-connect.c src/interfaces/libpq/fe-exec.c src/interfaces/libpq/fe-lobj.c src/interfaces/libpq/fe-misc.c src/interfaces/libpq/fe-print.c src/interfaces/libpq/fe-secure.c src/interfaces/libpq/fr.po src/interfaces/libpq/libpq-fe.h src/interfaces/libpq/libpq-int.h src/interfaces/libpq/libpq.rc src/interfaces/libpq/libpqdll.c src/interfaces/libpq/libpqdll.def src/interfaces/libpq/nls.mk src/interfaces/libpq/pqexpbuffer.c src/interfaces/libpq/pqexpbuffer.h src/interfaces/libpq/pqsignal.c src/interfaces/libpq/pqsignal.h src/interfaces/libpq/ru.po src/interfaces/libpq/sv.po src/interfaces/libpq/win32.c src/interfaces/libpq/win32.h src/interfaces/libpq/win32.mak src/interfaces/libpq/zh_CN.po src/interfaces/libpq/zh_TW.po src/interfaces/libpq++/CHANGES src/interfaces/libpq++/Makefile src/interfaces/libpq++/README src/interfaces/libpq++/TODO src/interfaces/libpq++/examples/Makefile src/interfaces/libpq++/examples/testlibpq0.cc src/interfaces/libpq++/examples/testlibpq1.cc src/interfaces/libpq++/examples/testlibpq2.cc src/interfaces/libpq++/examples/testlibpq2.sql src/interfaces/libpq++/examples/testlibpq3.cc src/interfaces/libpq++/examples/testlibpq3.sql src/interfaces/libpq++/examples/testlibpq4.cc src/interfaces/libpq++/examples/testlibpq4.sql src/interfaces/libpq++/examples/testlibpq5.cc src/interfaces/libpq++/examples/testlibpq5.sql src/interfaces/libpq++/examples/testlibpq6.cc src/interfaces/libpq++/examples/testlo.cc src/interfaces/libpq++/libpq++.h src/interfaces/libpq++/libpq++dll.rc src/interfaces/libpq++/pgconnection.cc src/interfaces/libpq++/pgconnection.h src/interfaces/libpq++/pgcursordb.cc src/interfaces/libpq++/pgcursordb.h src/interfaces/libpq++/pgdatabase.cc src/interfaces/libpq++/pgdatabase.h src/interfaces/libpq++/pglobject.cc src/interfaces/libpq++/pglobject.h src/interfaces/libpq++/pgtransdb.cc src/interfaces/libpq++/pgtransdb.h src/interfaces/libpq++/win32.mak src/interfaces/odbc/GNUmakefile src/interfaces/odbc/bind.c src/interfaces/odbc/bind.h src/interfaces/odbc/columninfo.c src/interfaces/odbc/columninfo.h src/interfaces/odbc/connection.c src/interfaces/odbc/connection.h src/interfaces/odbc/convert.c src/interfaces/odbc/convert.h src/interfaces/odbc/descriptor.h src/interfaces/odbc/dlg_specific.c src/interfaces/odbc/dlg_specific.h src/interfaces/odbc/dlg_wingui.c src/interfaces/odbc/drvconn.c src/interfaces/odbc/environ.c src/interfaces/odbc/environ.h src/interfaces/odbc/execute.c src/interfaces/odbc/gpps.c src/interfaces/odbc/gpps.h src/interfaces/odbc/info.c src/interfaces/odbc/info30.c src/interfaces/odbc/iodbc.h src/interfaces/odbc/isql.h src/interfaces/odbc/isqlext.h src/interfaces/odbc/license.txt src/interfaces/odbc/lobj.c src/interfaces/odbc/lobj.h src/interfaces/odbc/md5.c src/interfaces/odbc/md5.h src/interfaces/odbc/misc.c src/interfaces/odbc/misc.h src/interfaces/odbc/multibyte.c src/interfaces/odbc/multibyte.h src/interfaces/odbc/notice.txt src/interfaces/odbc/odbc.sql src/interfaces/odbc/odbcapi.c src/interfaces/odbc/odbcapi25w.c src/interfaces/odbc/odbcapi30.c src/interfaces/odbc/odbcapi30w.c src/interfaces/odbc/odbcapiw.c src/interfaces/odbc/odbcinst.ini src/interfaces/odbc/options.c src/interfaces/odbc/parse.c src/interfaces/odbc/pgapi30.c src/interfaces/odbc/pgapifunc.h src/interfaces/odbc/pgtypes.c src/interfaces/odbc/pgtypes.h src/interfaces/odbc/psqlodbc.c src/interfaces/odbc/psqlodbc.h src/interfaces/odbc/psqlodbc.rc src/interfaces/odbc/psqlodbc.reg src/interfaces/odbc/psqlodbc30.reg src/interfaces/odbc/psqlodbc30w.reg src/interfaces/odbc/psqlodbc_api30.def src/interfaces/odbc/psqlodbc_api30w.def src/interfaces/odbc/psqlodbc_apiw.def src/interfaces/odbc/psqlodbc_win32.def src/interfaces/odbc/qresult.c src/interfaces/odbc/qresult.h src/interfaces/odbc/readme.txt src/interfaces/odbc/resource.h src/interfaces/odbc/results.c src/interfaces/odbc/setup.c src/interfaces/odbc/setup.rul src/interfaces/odbc/socket.c src/interfaces/odbc/socket.h src/interfaces/odbc/statement.c src/interfaces/odbc/statement.h src/interfaces/odbc/tuple.c src/interfaces/odbc/tuple.h src/interfaces/odbc/tuplelist.c src/interfaces/odbc/tuplelist.h src/interfaces/odbc/version.h src/interfaces/odbc/win32.mak src/interfaces/odbc/win32_30.mak src/interfaces/odbc/win32_30w.mak src/interfaces/odbc/win32w.mak src/interfaces/odbc/win_md5.c src/interfaces/odbc/win_setup.h src/interfaces/odbc/win_unicode.c src/interfaces/perl5/Changes src/interfaces/perl5/GNUmakefile src/interfaces/perl5/MANIFEST src/interfaces/perl5/Makefile.PL src/interfaces/perl5/Pg.pm src/interfaces/perl5/Pg.xs src/interfaces/perl5/README src/interfaces/perl5/examples/ApachePg.pl src/interfaces/perl5/examples/example.newstyle src/interfaces/perl5/examples/example.oldstyle src/interfaces/perl5/ppport.h src/interfaces/perl5/test.pl src/interfaces/perl5/typemap src/interfaces/python/Announce src/interfaces/python/ChangeLog src/interfaces/python/GNUmakefile src/interfaces/python/PyGreSQL.spec src/interfaces/python/README src/interfaces/python/README.linux src/interfaces/python/Setup.in.raw src/interfaces/python/pg.py src/interfaces/python/pgdb.py src/interfaces/python/pgmodule.c src/interfaces/python/setup.py src/interfaces/python/tutorial/advanced.py src/interfaces/python/tutorial/basics.py src/interfaces/python/tutorial/func.py src/interfaces/python/tutorial/syscat.py src/interfaces/ssl/client.conf src/interfaces/ssl/mkcert.sh src/interfaces/ssl/pgkeygen.sh src/interfaces/ssl/root.conf src/interfaces/ssl/server.conf src/makefiles/Makefile.aix src/makefiles/Makefile.beos src/makefiles/Makefile.bsdi src/makefiles/Makefile.darwin src/makefiles/Makefile.dgux src/makefiles/Makefile.freebsd src/makefiles/Makefile.hpux src/makefiles/Makefile.irix5 src/makefiles/Makefile.linux src/makefiles/Makefile.netbsd src/makefiles/Makefile.openbsd src/makefiles/Makefile.osf src/makefiles/Makefile.qnx4 src/makefiles/Makefile.sco src/makefiles/Makefile.solaris src/makefiles/Makefile.sunos4 src/makefiles/Makefile.svr4 src/makefiles/Makefile.ultrix4 src/makefiles/Makefile.univel src/makefiles/Makefile.unixware src/makefiles/Makefile.win src/nls-global.mk src/pl/Makefile src/pl/plperl/GNUmakefile src/pl/plperl/README src/pl/plperl/SPI.xs src/pl/plperl/eloglvl.c src/pl/plperl/eloglvl.h src/pl/plperl/plperl.c src/pl/plperl/ppport.h src/pl/plpgsql/Makefile src/pl/plpgsql/src/.cvsignore src/pl/plpgsql/src/INSTALL src/pl/plpgsql/src/Makefile src/pl/plpgsql/src/gram.y src/pl/plpgsql/src/pl_comp.c src/pl/plpgsql/src/pl_exec.c src/pl/plpgsql/src/pl_funcs.c src/pl/plpgsql/src/pl_handler.c src/pl/plpgsql/src/plpgsql.h src/pl/plpgsql/src/scan.l src/pl/plpgsql/test/README src/pl/plpgsql/test/expected/tables.out src/pl/plpgsql/test/expected/test.out src/pl/plpgsql/test/expected/triggers.out src/pl/plpgsql/test/expected/views.out src/pl/plpgsql/test/runtest src/pl/plpgsql/test/tables.sql src/pl/plpgsql/test/test.sql src/pl/plpgsql/test/triggers.sql src/pl/plpgsql/test/views.sql src/pl/plpython/Makefile src/pl/plpython/README src/pl/plpython/TODO src/pl/plpython/error.expected src/pl/plpython/feature.expected src/pl/plpython/plpython.c src/pl/plpython/plpython.h src/pl/plpython/plpython_depopulate.sql src/pl/plpython/plpython_deschema.sql src/pl/plpython/plpython_drop.sql src/pl/plpython/plpython_error.sql src/pl/plpython/plpython_function.sql src/pl/plpython/plpython_populate.sql src/pl/plpython/plpython_schema.sql src/pl/plpython/plpython_setof.sql src/pl/plpython/plpython_test.sql src/pl/plpython/test.sh src/pl/tcl/Makefile src/pl/tcl/license.terms src/pl/tcl/modules/Makefile src/pl/tcl/modules/README src/pl/tcl/modules/pltcl_delmod.in src/pl/tcl/modules/pltcl_listmod.in src/pl/tcl/modules/pltcl_loadmod.in src/pl/tcl/modules/unknown.pltcl src/pl/tcl/pltcl.c src/pl/tcl/test/README src/pl/tcl/test/runtest src/pl/tcl/test/test.expected src/pl/tcl/test/test_queries.sql src/pl/tcl/test/test_setup.sql src/template/aix src/template/beos src/template/bsdi src/template/darwin src/template/dgux src/template/freebsd src/template/hpux src/template/irix5 src/template/linux src/template/netbsd src/template/nextstep src/template/openbsd src/template/osf src/template/qnx4 src/template/sco src/template/solaris src/template/sunos4 src/template/svr4 src/template/ultrix4 src/template/univel src/template/unixware src/template/win src/test/Makefile src/test/bench/Makefile src/test/bench/WISC-README src/test/bench/create.sh src/test/bench/create.source src/test/bench/perquery src/test/bench/query01 src/test/bench/query02 src/test/bench/query03 src/test/bench/query04 src/test/bench/query05 src/test/bench/query06 src/test/bench/query07 src/test/bench/query08 src/test/bench/query09 src/test/bench/query10 src/test/bench/query11 src/test/bench/query12 src/test/bench/query13 src/test/bench/query14 src/test/bench/query15 src/test/bench/query16 src/test/bench/query17 src/test/bench/query18 src/test/bench/query19 src/test/bench/query20 src/test/bench/query21 src/test/bench/query22 src/test/bench/query23 src/test/bench/query24 src/test/bench/query25 src/test/bench/query26 src/test/bench/query27 src/test/bench/query28 src/test/bench/query29 src/test/bench/query30 src/test/bench/query31 src/test/bench/query32 src/test/bench/runwisc.sh src/test/bench/wholebench.sh src/test/examples/Makefile src/test/examples/testlibpq.c src/test/examples/testlibpq2.c src/test/examples/testlibpq2.sql src/test/examples/testlibpq3.c src/test/examples/testlibpq3.sql src/test/examples/testlibpq4.c src/test/examples/testlo.c src/test/locale/Makefile src/test/locale/README src/test/locale/de_DE.ISO8859-1/Makefile src/test/locale/de_DE.ISO8859-1/README src/test/locale/de_DE.ISO8859-1/expected/de-ctype.out src/test/locale/de_DE.ISO8859-1/expected/test-de-char.sql.out src/test/locale/de_DE.ISO8859-1/expected/test-de-select.sql.out src/test/locale/de_DE.ISO8859-1/expected/test-de-sort.out src/test/locale/de_DE.ISO8859-1/expected/test-de-text.sql.out src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-char.sql.out src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-text.sql.out src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-varchar.sql.out src/test/locale/de_DE.ISO8859-1/expected/test-de-varchar.sql.out src/test/locale/de_DE.ISO8859-1/runall src/test/locale/de_DE.ISO8859-1/test-de-select.sql.in src/test/locale/de_DE.ISO8859-1/test-de-sort.in src/test/locale/de_DE.ISO8859-1/test-de-upper.sql.in src/test/locale/de_DE.ISO8859-1/test-de.sql.in src/test/locale/gr_GR.ISO8859-7/Makefile src/test/locale/gr_GR.ISO8859-7/README src/test/locale/gr_GR.ISO8859-7/expected/gr-ctype.out src/test/locale/gr_GR.ISO8859-7/expected/test-gr-char.sql.out src/test/locale/gr_GR.ISO8859-7/expected/test-gr-select.sql.out src/test/locale/gr_GR.ISO8859-7/expected/test-gr-sort.out src/test/locale/gr_GR.ISO8859-7/expected/test-gr-text.sql.out src/test/locale/gr_GR.ISO8859-7/expected/test-gr-varchar.sql.out src/test/locale/gr_GR.ISO8859-7/runall src/test/locale/gr_GR.ISO8859-7/test-gr-select.sql.in src/test/locale/gr_GR.ISO8859-7/test-gr-sort.in src/test/locale/gr_GR.ISO8859-7/test-gr.sql.in src/test/locale/koi8-r/Makefile src/test/locale/koi8-r/expected/koi8-ctype.out src/test/locale/koi8-r/expected/test-koi8-char.sql.out src/test/locale/koi8-r/expected/test-koi8-select.sql.out src/test/locale/koi8-r/expected/test-koi8-sort.out src/test/locale/koi8-r/expected/test-koi8-text.sql.out src/test/locale/koi8-r/expected/test-koi8-varchar.sql.out src/test/locale/koi8-r/runall src/test/locale/koi8-r/test-koi8-select.sql.in src/test/locale/koi8-r/test-koi8-sort.in src/test/locale/koi8-r/test-koi8.sql.in src/test/locale/koi8-to-win1251/Makefile src/test/locale/koi8-to-win1251/README src/test/locale/koi8-to-win1251/expected/test-koi8-char.sql.out src/test/locale/koi8-to-win1251/expected/test-koi8-select.sql.out src/test/locale/koi8-to-win1251/expected/test-koi8-sort.out src/test/locale/koi8-to-win1251/expected/test-koi8-text.sql.out src/test/locale/koi8-to-win1251/expected/test-koi8-varchar.sql.out src/test/locale/koi8-to-win1251/runall src/test/locale/koi8-to-win1251/test-koi8-select.sql.in src/test/locale/koi8-to-win1251/test-koi8-sort.in src/test/locale/koi8-to-win1251/test-koi8.sql.in src/test/locale/sort-test.pl src/test/locale/sort-test.py src/test/locale/test-ctype.c src/test/locale/test-pgsql-locale.c src/test/mb/README src/test/mb/expected/big5.out src/test/mb/expected/euc_cn.out src/test/mb/expected/euc_jp.out src/test/mb/expected/euc_kr.out src/test/mb/expected/euc_tw.out src/test/mb/expected/mule_internal.out src/test/mb/expected/sjis.out src/test/mb/expected/unicode.out src/test/mb/mbregress.sh src/test/mb/sql/big5.sql src/test/mb/sql/euc_cn.sql src/test/mb/sql/euc_jp.sql src/test/mb/sql/euc_kr.sql src/test/mb/sql/euc_tw.sql src/test/mb/sql/mule_internal.sql src/test/mb/sql/sjis.sql src/test/mb/sql/unicode.sql src/test/performance/results/PgSQL.970926 src/test/performance/runtests.pl src/test/performance/sqls/connection src/test/performance/sqls/crtsimple src/test/performance/sqls/crtsimpleidx src/test/performance/sqls/drpsimple src/test/performance/sqls/inssimple src/test/performance/sqls/inssimple.data src/test/performance/sqls/orbsimple src/test/performance/sqls/slcsimple src/test/performance/sqls/slcsimple.data src/test/performance/sqls/vacuum src/test/performance/start-pgsql.sh src/test/regress/GNUmakefile src/test/regress/Makefile src/test/regress/README src/test/regress/data/agg.data src/test/regress/data/constrf.data src/test/regress/data/constro.data src/test/regress/data/dept.data src/test/regress/data/desc.data src/test/regress/data/emp.data src/test/regress/data/hash.data src/test/regress/data/onek.data src/test/regress/data/person.data src/test/regress/data/real_city.data src/test/regress/data/rect.data src/test/regress/data/streets.data src/test/regress/data/stud_emp.data src/test/regress/data/student.data src/test/regress/data/tenk.data src/test/regress/expected/abstime-solaris-1947.out src/test/regress/expected/abstime.out src/test/regress/expected/aggregates.out src/test/regress/expected/alter_table.out src/test/regress/expected/arrays.out src/test/regress/expected/bit.out src/test/regress/expected/boolean.out src/test/regress/expected/box.out src/test/regress/expected/btree_index.out src/test/regress/expected/case.out src/test/regress/expected/char.out src/test/regress/expected/char_1.out src/test/regress/expected/circle.out src/test/regress/expected/comments.out src/test/regress/expected/create_aggregate.out src/test/regress/expected/create_index.out src/test/regress/expected/create_misc.out src/test/regress/expected/create_operator.out src/test/regress/expected/create_table.out src/test/regress/expected/create_type.out src/test/regress/expected/create_view.out src/test/regress/expected/date.out src/test/regress/expected/domain.out src/test/regress/expected/errors.out src/test/regress/expected/euc_cn.out src/test/regress/expected/euc_jp.out src/test/regress/expected/euc_kr.out src/test/regress/expected/euc_tw.out src/test/regress/expected/float4-exp-three-digits.out src/test/regress/expected/float4.out src/test/regress/expected/float8-exp-three-digits.out src/test/regress/expected/float8-fp-exception.out src/test/regress/expected/float8-small-is-zero.out src/test/regress/expected/float8.out src/test/regress/expected/foreign_key.out src/test/regress/expected/geometry-alpha-precision.out src/test/regress/expected/geometry-bsdi-precision.out src/test/regress/expected/geometry-i86-gnulibc.out src/test/regress/expected/geometry-intel-beos.out src/test/regress/expected/geometry-irix.out src/test/regress/expected/geometry-positive-zeros-bsd.out src/test/regress/expected/geometry-positive-zeros.out src/test/regress/expected/geometry-powerpc-aix4.out src/test/regress/expected/geometry-powerpc-darwin.out src/test/regress/expected/geometry-powerpc-linux-gnulibc1.out src/test/regress/expected/geometry-solaris-i386-pc.out src/test/regress/expected/geometry-solaris-precision.out src/test/regress/expected/geometry-uw7-cc.out src/test/regress/expected/geometry-uw7-gcc.out src/test/regress/expected/geometry.out src/test/regress/expected/hash_index.out src/test/regress/expected/horology-no-DST-before-1970.out src/test/regress/expected/horology-solaris-1947.out src/test/regress/expected/horology.out src/test/regress/expected/inet.out src/test/regress/expected/inherit.out src/test/regress/expected/insert.out src/test/regress/expected/int2.out src/test/regress/expected/int4.out src/test/regress/expected/int8-exp-three-digits.out src/test/regress/expected/int8.out src/test/regress/expected/interval.out src/test/regress/expected/join.out src/test/regress/expected/limit.out src/test/regress/expected/lseg.out src/test/regress/expected/mule_internal.out src/test/regress/expected/name.out src/test/regress/expected/numeric.out src/test/regress/expected/numeric_big.out src/test/regress/expected/numerology.out src/test/regress/expected/oid.out src/test/regress/expected/oidjoins.out src/test/regress/expected/opr_sanity.out src/test/regress/expected/path.out src/test/regress/expected/plpgsql.out src/test/regress/expected/point.out src/test/regress/expected/polygon.out src/test/regress/expected/portals.out src/test/regress/expected/portals_p2.out src/test/regress/expected/privileges.out src/test/regress/expected/random.out src/test/regress/expected/reltime.out src/test/regress/expected/rules.out src/test/regress/expected/sanity_check.out src/test/regress/expected/select.out src/test/regress/expected/select_distinct.out src/test/regress/expected/select_distinct_on.out src/test/regress/expected/select_having.out src/test/regress/expected/select_having_1.out src/test/regress/expected/select_implicit.out src/test/regress/expected/select_implicit_1.out src/test/regress/expected/select_into.out src/test/regress/expected/select_views.out src/test/regress/expected/select_views_1.out src/test/regress/expected/sql_ascii.out src/test/regress/expected/strings.out src/test/regress/expected/subselect.out src/test/regress/expected/temp.out src/test/regress/expected/text.out src/test/regress/expected/time.out src/test/regress/expected/timestamp.out src/test/regress/expected/timestamptz.out src/test/regress/expected/timetz.out src/test/regress/expected/tinterval-solaris-1947.out src/test/regress/expected/tinterval.out src/test/regress/expected/transactions.out src/test/regress/expected/triggers.out src/test/regress/expected/type_sanity.out src/test/regress/expected/union.out src/test/regress/expected/varchar.out src/test/regress/expected/varchar_1.out src/test/regress/input/constraints.source src/test/regress/input/copy.source src/test/regress/input/create_function_1.source src/test/regress/input/create_function_2.source src/test/regress/input/misc.source src/test/regress/output/constraints.source src/test/regress/output/copy.source src/test/regress/output/create_function_1.source src/test/regress/output/create_function_2.source src/test/regress/output/misc.source src/test/regress/parallel_schedule src/test/regress/pg_regress.sh src/test/regress/regress.c src/test/regress/regressplans.sh src/test/regress/resultmap src/test/regress/serial_schedule src/test/regress/sql/abstime.sql src/test/regress/sql/aggregates.sql src/test/regress/sql/alter_table.sql src/test/regress/sql/arrays.sql src/test/regress/sql/bit.sql src/test/regress/sql/boolean.sql src/test/regress/sql/box.sql src/test/regress/sql/btree_index.sql src/test/regress/sql/case.sql src/test/regress/sql/char.sql src/test/regress/sql/circle.sql src/test/regress/sql/comments.sql src/test/regress/sql/create_aggregate.sql src/test/regress/sql/create_index.sql src/test/regress/sql/create_misc.sql src/test/regress/sql/create_operator.sql src/test/regress/sql/create_table.sql src/test/regress/sql/create_type.sql src/test/regress/sql/create_view.sql src/test/regress/sql/date.sql src/test/regress/sql/domain.sql src/test/regress/sql/drop.sql src/test/regress/sql/errors.sql src/test/regress/sql/euc_cn.sql src/test/regress/sql/euc_jp.sql src/test/regress/sql/euc_kr.sql src/test/regress/sql/euc_tw.sql src/test/regress/sql/float4.sql src/test/regress/sql/float8.sql src/test/regress/sql/foreign_key.sql src/test/regress/sql/geometry.sql src/test/regress/sql/hash_index.sql src/test/regress/sql/horology.sql src/test/regress/sql/inet.sql src/test/regress/sql/inherit.sql src/test/regress/sql/insert.sql src/test/regress/sql/int2.sql src/test/regress/sql/int4.sql src/test/regress/sql/int8.sql src/test/regress/sql/interval.sql src/test/regress/sql/join.sql src/test/regress/sql/limit.sql src/test/regress/sql/lseg.sql src/test/regress/sql/mule_internal.sql src/test/regress/sql/name.sql src/test/regress/sql/numeric.sql src/test/regress/sql/numeric_big.sql src/test/regress/sql/numerology.sql src/test/regress/sql/oid.sql src/test/regress/sql/oidjoins.sql src/test/regress/sql/opr_sanity.sql src/test/regress/sql/path.sql src/test/regress/sql/plpgsql.sql src/test/regress/sql/point.sql src/test/regress/sql/polygon.sql src/test/regress/sql/portals.sql src/test/regress/sql/portals_p2.sql src/test/regress/sql/privileges.sql src/test/regress/sql/random.sql src/test/regress/sql/reltime.sql src/test/regress/sql/rules.sql src/test/regress/sql/sanity_check.sql src/test/regress/sql/select.sql src/test/regress/sql/select_distinct.sql src/test/regress/sql/select_distinct_on.sql src/test/regress/sql/select_having.sql src/test/regress/sql/select_implicit.sql src/test/regress/sql/select_into.sql src/test/regress/sql/select_views.sql src/test/regress/sql/sql_ascii.sql src/test/regress/sql/strings.sql src/test/regress/sql/subselect.sql src/test/regress/sql/temp.sql src/test/regress/sql/text.sql src/test/regress/sql/time.sql src/test/regress/sql/timestamp.sql src/test/regress/sql/timestamptz.sql src/test/regress/sql/timetz.sql src/test/regress/sql/tinterval.sql src/test/regress/sql/transactions.sql src/test/regress/sql/triggers.sql src/test/regress/sql/type_sanity.sql src/test/regress/sql/union.sql src/test/regress/sql/varchar.sql src/tools/RELEASE_CHANGES src/tools/backend/README src/tools/backend/backend_dirs.html src/tools/backend/flow.fig src/tools/backend/flow.gif src/tools/backend/index.html src/tools/ccsym src/tools/copyright src/tools/entab/Makefile src/tools/entab/entab.c src/tools/entab/entab.man src/tools/entab/halt.c src/tools/find_badmacros src/tools/find_static src/tools/find_typedef src/tools/make_ctags src/tools/make_diff/README src/tools/make_diff/cporig src/tools/make_diff/difforig src/tools/make_diff/rmorig src/tools/make_etags src/tools/make_keywords src/tools/make_mkid src/tools/pgcvslog src/tools/pginclude/README src/tools/pginclude/pgcompinclude src/tools/pginclude/pgdefine src/tools/pginclude/pgfixinclude src/tools/pginclude/pgrminclude src/tools/pgindent/README src/tools/pgindent/indent.bsd.patch src/tools/pgindent/pgcppindent src/tools/pgindent/pgindent src/tools/pgindent/pgjindent src/tutorial/Makefile src/tutorial/README src/tutorial/advanced.source src/tutorial/basics.source src/tutorial/beard.c src/tutorial/complex.c src/tutorial/complex.source src/tutorial/funcs.c src/tutorial/funcs.source src/tutorial/funcs_new.c src/tutorial/syscat.source src/utils/Makefile src/utils/README src/utils/dllinit.c src/utils/getopt.c src/utils/strdup.c src/win32.mak --- src/backend/commands/tablecmds.c | 3094 -------------------------------------- 1 file changed, 3094 deletions(-) delete mode 100644 src/backend/commands/tablecmds.c (limited to 'src/backend/commands/tablecmds.c') diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c deleted file mode 100644 index 3bcf774ba29..00000000000 --- a/src/backend/commands/tablecmds.c +++ /dev/null @@ -1,3094 +0,0 @@ -/*------------------------------------------------------------------------- - * - * tablecmds.c - * Commands for creating and altering table structures and settings - * - * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * - * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.17 2002/06/17 14:31:32 tgl Exp $ - * - *------------------------------------------------------------------------- - */ -#include "postgres.h" - -#include "access/genam.h" -#include "access/tuptoaster.h" -#include "catalog/catalog.h" -#include "catalog/catname.h" -#include "catalog/heap.h" -#include "catalog/index.h" -#include "catalog/indexing.h" -#include "catalog/namespace.h" -#include "catalog/pg_attrdef.h" -#include "catalog/pg_inherits.h" -#include "catalog/pg_namespace.h" -#include "catalog/pg_opclass.h" -#include "catalog/pg_trigger.h" -#include "catalog/pg_type.h" -#include "commands/tablecmds.h" -#include "commands/trigger.h" -#include "executor/executor.h" -#include "miscadmin.h" -#include "nodes/makefuncs.h" -#include "optimizer/clauses.h" -#include "optimizer/planmain.h" -#include "optimizer/prep.h" -#include "parser/parse.h" -#include "parser/parse_coerce.h" -#include "parser/parse_expr.h" -#include "parser/parse_relation.h" -#include "parser/parse_type.h" -#include "utils/acl.h" -#include "utils/builtins.h" -#include "utils/fmgroids.h" -#include "utils/lsyscache.h" -#include "utils/syscache.h" -#include "utils/relcache.h" - - -static List *MergeDomainAttributes(List *schema); -static List *MergeAttributes(List *schema, List *supers, bool istemp, - List **supOids, List **supconstr, bool *supHasOids); -static bool change_varattnos_of_a_node(Node *node, const AttrNumber *newattno); -static void StoreCatalogInheritance(Oid relationId, List *supers); -static int findAttrByName(const char *attributeName, List *schema); -static void setRelhassubclassInRelation(Oid relationId, bool relhassubclass); -static void drop_default(Oid relid, int16 attnum); -static void CheckTupleType(Form_pg_class tuple_class); -static bool needs_toast_table(Relation rel); - -/* Used by attribute and relation renaming routines: */ - -#define RI_TRIGGER_PK 1 /* is a trigger on the PK relation */ -#define RI_TRIGGER_FK 2 /* is a trigger on the FK relation */ -#define RI_TRIGGER_NONE 0 /* is not an RI trigger function */ - -static int ri_trigger_type(Oid tgfoid); -static void update_ri_trigger_args(Oid relid, - const char *oldname, - const char *newname, - bool fk_scan, - bool update_relname); - - -/* ---------------------------------------------------------------- - * DefineRelation - * Creates a new relation. - * - * If successful, returns the OID of the new relation. - * ---------------------------------------------------------------- - */ -Oid -DefineRelation(CreateStmt *stmt, char relkind) -{ - char relname[NAMEDATALEN]; - Oid namespaceId; - List *schema = stmt->tableElts; - int numberOfAttributes; - Oid relationId; - Relation rel; - TupleDesc descriptor; - List *inheritOids; - List *old_constraints; - bool parentHasOids; - List *rawDefaults; - List *listptr; - int i; - AttrNumber attnum; - - /* - * Truncate relname to appropriate length (probably a waste of time, - * as parser should have done this already). - */ - StrNCpy(relname, stmt->relation->relname, NAMEDATALEN); - - /* - * Look up the namespace in which we are supposed to create the - * relation. Check we have permission to create there. - * Skip check if bootstrapping, since permissions machinery may not - * be working yet; also, always allow if it's a temp table. - */ - namespaceId = RangeVarGetCreationNamespace(stmt->relation); - - if (!IsBootstrapProcessingMode() && !isTempNamespace(namespaceId)) - { - AclResult aclresult; - - aclresult = pg_namespace_aclcheck(namespaceId, GetUserId(), - ACL_CREATE); - if (aclresult != ACLCHECK_OK) - aclcheck_error(aclresult, get_namespace_name(namespaceId)); - } - - /* - * Merge domain attributes into the known columns before processing table - * inheritance. Otherwise we risk adding double constraints to a - * domain-type column that's inherited. - */ - schema = MergeDomainAttributes(schema); - - /* - * Look up inheritance ancestors and generate relation schema, - * including inherited attributes. - */ - schema = MergeAttributes(schema, stmt->inhRelations, - stmt->relation->istemp, - &inheritOids, &old_constraints, &parentHasOids); - - numberOfAttributes = length(schema); - if (numberOfAttributes <= 0) - elog(ERROR, "DefineRelation: please inherit from a relation or define an attribute"); - - /* - * Create a relation descriptor from the relation schema and create - * the relation. Note that in this stage only inherited (pre-cooked) - * defaults and constraints will be included into the new relation. - * (BuildDescForRelation takes care of the inherited defaults, but we - * have to copy inherited constraints here.) - */ - descriptor = BuildDescForRelation(schema); - - if (old_constraints != NIL) - { - ConstrCheck *check = (ConstrCheck *) palloc(length(old_constraints) * - sizeof(ConstrCheck)); - int ncheck = 0; - - foreach(listptr, old_constraints) - { - Constraint *cdef = (Constraint *) lfirst(listptr); - - if (cdef->contype != CONSTR_CHECK) - continue; - - if (cdef->name != NULL) - { - for (i = 0; i < ncheck; i++) - { - if (strcmp(check[i].ccname, cdef->name) == 0) - elog(ERROR, "Duplicate CHECK constraint name: '%s'", - cdef->name); - } - check[ncheck].ccname = cdef->name; - } - else - { - check[ncheck].ccname = (char *) palloc(NAMEDATALEN); - snprintf(check[ncheck].ccname, NAMEDATALEN, "$%d", ncheck + 1); - } - Assert(cdef->raw_expr == NULL && cdef->cooked_expr != NULL); - check[ncheck].ccbin = pstrdup(cdef->cooked_expr); - ncheck++; - } - if (ncheck > 0) - { - if (descriptor->constr == NULL) - { - descriptor->constr = (TupleConstr *) palloc(sizeof(TupleConstr)); - descriptor->constr->defval = NULL; - descriptor->constr->num_defval = 0; - descriptor->constr->has_not_null = false; - } - descriptor->constr->num_check = ncheck; - descriptor->constr->check = check; - } - } - - relationId = heap_create_with_catalog(relname, - namespaceId, - descriptor, - relkind, - false, - stmt->hasoids || parentHasOids, - allowSystemTableMods); - - StoreCatalogInheritance(relationId, inheritOids); - - /* - * We must bump the command counter to make the newly-created relation - * tuple visible for opening. - */ - CommandCounterIncrement(); - - /* - * Open the new relation and acquire exclusive lock on it. This isn't - * really necessary for locking out other backends (since they can't - * see the new rel anyway until we commit), but it keeps the lock - * manager from complaining about deadlock risks. - */ - rel = heap_open(relationId, AccessExclusiveLock); - - /* - * Now add any newly specified column default values and CHECK - * constraints to the new relation. These are passed to us in the - * form of raw parsetrees; we need to transform them to executable - * expression trees before they can be added. The most convenient way - * to do that is to apply the parser's transformExpr routine, but - * transformExpr doesn't work unless we have a pre-existing relation. - * So, the transformation has to be postponed to this final step of - * CREATE TABLE. - * - * First, scan schema to find new column defaults. - */ - rawDefaults = NIL; - attnum = 0; - - foreach(listptr, schema) - { - ColumnDef *colDef = lfirst(listptr); - RawColumnDefault *rawEnt; - - attnum++; - - if (colDef->raw_default == NULL) - continue; - Assert(colDef->cooked_default == NULL); - - rawEnt = (RawColumnDefault *) palloc(sizeof(RawColumnDefault)); - rawEnt->attnum = attnum; - rawEnt->raw_default = colDef->raw_default; - rawDefaults = lappend(rawDefaults, rawEnt); - } - - /* - * Parse and add the defaults/constraints, if any. - */ - if (rawDefaults || stmt->constraints) - AddRelationRawConstraints(rel, rawDefaults, stmt->constraints); - - /* - * Clean up. We keep lock on new relation (although it shouldn't be - * visible to anyone else anyway, until commit). - */ - heap_close(rel, NoLock); - - return relationId; -} - -/* - * RemoveRelation - * Deletes a relation. - * - * Exceptions: - * BadArg if name is invalid. - * - * Note: - * If the relation has indices defined on it, then the index relations - * themselves will be destroyed, too. - */ -void -RemoveRelation(const RangeVar *relation) -{ - Oid relOid; - - relOid = RangeVarGetRelid(relation, false); - heap_drop_with_catalog(relOid, allowSystemTableMods); -} - -/* - * TruncateRelation - * Removes all the rows from a relation - * - * Exceptions: - * BadArg if name is invalid - * - * Note: - * Rows are removed, indices are truncated and reconstructed. - */ -void -TruncateRelation(const RangeVar *relation) -{ - Relation rel; - Oid relid; - - /* Grab exclusive lock in preparation for truncate */ - rel = heap_openrv(relation, AccessExclusiveLock); - relid = RelationGetRelid(rel); - - if (rel->rd_rel->relkind == RELKIND_SEQUENCE) - elog(ERROR, "TRUNCATE cannot be used on sequences. '%s' is a sequence", - RelationGetRelationName(rel)); - - if (rel->rd_rel->relkind == RELKIND_VIEW) - elog(ERROR, "TRUNCATE cannot be used on views. '%s' is a view", - RelationGetRelationName(rel)); - - if (!allowSystemTableMods && IsSystemRelation(rel)) - elog(ERROR, "TRUNCATE cannot be used on system tables. '%s' is a system table", - RelationGetRelationName(rel)); - - if (!pg_class_ownercheck(relid, GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(rel)); - - /* Keep the lock until transaction commit */ - heap_close(rel, NoLock); - - heap_truncate(relid); -} - - -/* - * MergeDomainAttributes - * Returns a new table schema with the constraints, types, and other - * attributes of domains resolved for fields using a domain as - * their type. - */ -static List * -MergeDomainAttributes(List *schema) -{ - List *entry; - - /* - * Loop through the table elements supplied. These should - * never include inherited domains else they'll be - * double (or more) processed. - */ - foreach(entry, schema) - { - ColumnDef *coldef = lfirst(entry); - HeapTuple tuple; - Form_pg_type typeTup; - - tuple = typenameType(coldef->typename); - typeTup = (Form_pg_type) GETSTRUCT(tuple); - - if (typeTup->typtype == 'd') - { - /* Force the column to have the correct typmod. */ - coldef->typename->typmod = typeTup->typtypmod; - /* XXX more to do here? */ - } - - /* Enforce type NOT NULL || column definition NOT NULL -> NOT NULL */ - /* Currently only used for domains, but could be valid for all */ - coldef->is_not_null |= typeTup->typnotnull; - - ReleaseSysCache(tuple); - } - - return schema; -} - -/*---------- - * MergeAttributes - * Returns new schema given initial schema and superclasses. - * - * Input arguments: - * 'schema' is the column/attribute definition for the table. (It's a list - * of ColumnDef's.) It is destructively changed. - * 'supers' is a list of names (as RangeVar nodes) of parent relations. - * 'istemp' is TRUE if we are creating a temp relation. - * - * Output arguments: - * 'supOids' receives an integer list of the OIDs of the parent relations. - * 'supconstr' receives a list of constraints belonging to the parents, - * updated as necessary to be valid for the child. - * 'supHasOids' is set TRUE if any parent has OIDs, else it is set FALSE. - * - * Return value: - * Completed schema list. - * - * Notes: - * The order in which the attributes are inherited is very important. - * Intuitively, the inherited attributes should come first. If a table - * inherits from multiple parents, the order of those attributes are - * according to the order of the parents specified in CREATE TABLE. - * - * Here's an example: - * - * create table person (name text, age int4, location point); - * create table emp (salary int4, manager text) inherits(person); - * create table student (gpa float8) inherits (person); - * create table stud_emp (percent int4) inherits (emp, student); - * - * The order of the attributes of stud_emp is: - * - * person {1:name, 2:age, 3:location} - * / \ - * {6:gpa} student emp {4:salary, 5:manager} - * \ / - * stud_emp {7:percent} - * - * If the same attribute name appears multiple times, then it appears - * in the result table in the proper location for its first appearance. - * - * Constraints (including NOT NULL constraints) for the child table - * are the union of all relevant constraints, from both the child schema - * and parent tables. - * - * The default value for a child column is defined as: - * (1) If the child schema specifies a default, that value is used. - * (2) If neither the child nor any parent specifies a default, then - * the column will not have a default. - * (3) If conflicting defaults are inherited from different parents - * (and not overridden by the child), an error is raised. - * (4) Otherwise the inherited default is used. - * Rule (3) is new in Postgres 7.1; in earlier releases you got a - * rather arbitrary choice of which parent default to use. - *---------- - */ -static List * -MergeAttributes(List *schema, List *supers, bool istemp, - List **supOids, List **supconstr, bool *supHasOids) -{ - List *entry; - List *inhSchema = NIL; - List *parentOids = NIL; - List *constraints = NIL; - bool parentHasOids = false; - bool have_bogus_defaults = false; - char *bogus_marker = "Bogus!"; /* marks conflicting - * defaults */ - int child_attno; - - /* - * Check for duplicate names in the explicit list of attributes. - * - * Although we might consider merging such entries in the same way that - * we handle name conflicts for inherited attributes, it seems to make - * more sense to assume such conflicts are errors. - */ - foreach(entry, schema) - { - ColumnDef *coldef = lfirst(entry); - List *rest; - - foreach(rest, lnext(entry)) - { - ColumnDef *restdef = lfirst(rest); - - if (strcmp(coldef->colname, restdef->colname) == 0) - elog(ERROR, "CREATE TABLE: attribute \"%s\" duplicated", - coldef->colname); - } - } - - /* - * Scan the parents left-to-right, and merge their attributes to form - * a list of inherited attributes (inhSchema). Also check to see if - * we need to inherit an OID column. - */ - child_attno = 0; - foreach(entry, supers) - { - RangeVar *parent = (RangeVar *) lfirst(entry); - Relation relation; - TupleDesc tupleDesc; - TupleConstr *constr; - AttrNumber *newattno; - AttrNumber parent_attno; - - relation = heap_openrv(parent, AccessShareLock); - - if (relation->rd_rel->relkind != RELKIND_RELATION) - elog(ERROR, "CREATE TABLE: inherited relation \"%s\" is not a table", - parent->relname); - /* Permanent rels cannot inherit from temporary ones */ - if (!istemp && isTempNamespace(RelationGetNamespace(relation))) - elog(ERROR, "CREATE TABLE: cannot inherit from temp relation \"%s\"", - parent->relname); - - /* - * We should have an UNDER permission flag for this, but for now, - * demand that creator of a child table own the parent. - */ - if (!pg_class_ownercheck(RelationGetRelid(relation), GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, - RelationGetRelationName(relation)); - - /* - * Reject duplications in the list of parents. - */ - if (intMember(RelationGetRelid(relation), parentOids)) - elog(ERROR, "CREATE TABLE: inherited relation \"%s\" duplicated", - parent->relname); - - parentOids = lappendi(parentOids, RelationGetRelid(relation)); - setRelhassubclassInRelation(RelationGetRelid(relation), true); - - parentHasOids |= relation->rd_rel->relhasoids; - - tupleDesc = RelationGetDescr(relation); - constr = tupleDesc->constr; - - /* - * newattno[] will contain the child-table attribute numbers for - * the attributes of this parent table. (They are not the same - * for parents after the first one.) - */ - newattno = (AttrNumber *) palloc(tupleDesc->natts * sizeof(AttrNumber)); - - for (parent_attno = 1; parent_attno <= tupleDesc->natts; - parent_attno++) - { - Form_pg_attribute attribute = tupleDesc->attrs[parent_attno - 1]; - char *attributeName = NameStr(attribute->attname); - int exist_attno; - ColumnDef *def; - TypeName *typename; - - /* - * Does it conflict with some previously inherited column? - */ - exist_attno = findAttrByName(attributeName, inhSchema); - if (exist_attno > 0) - { - /* - * Yes, try to merge the two column definitions. They must - * have the same type and typmod. - */ - elog(NOTICE, "CREATE TABLE: merging multiple inherited definitions of attribute \"%s\"", - attributeName); - def = (ColumnDef *) nth(exist_attno - 1, inhSchema); - if (typenameTypeId(def->typename) != attribute->atttypid || - def->typename->typmod != attribute->atttypmod) - elog(ERROR, "CREATE TABLE: inherited attribute \"%s\" type conflict (%s and %s)", - attributeName, - TypeNameToString(def->typename), - format_type_be(attribute->atttypid)); - /* Merge of NOT NULL constraints = OR 'em together */ - def->is_not_null |= attribute->attnotnull; - /* Default and other constraints are handled below */ - newattno[parent_attno - 1] = exist_attno; - } - else - { - /* - * No, create a new inherited column - */ - def = makeNode(ColumnDef); - def->colname = pstrdup(attributeName); - typename = makeNode(TypeName); - typename->typeid = attribute->atttypid; - typename->typmod = attribute->atttypmod; - def->typename = typename; - def->is_not_null = attribute->attnotnull; - def->raw_default = NULL; - def->cooked_default = NULL; - def->constraints = NIL; - inhSchema = lappend(inhSchema, def); - newattno[parent_attno - 1] = ++child_attno; - } - - /* - * Copy default if any - */ - if (attribute->atthasdef) - { - char *this_default = NULL; - AttrDefault *attrdef; - int i; - - /* Find default in constraint structure */ - Assert(constr != NULL); - attrdef = constr->defval; - for (i = 0; i < constr->num_defval; i++) - { - if (attrdef[i].adnum == parent_attno) - { - this_default = attrdef[i].adbin; - break; - } - } - Assert(this_default != NULL); - - /* - * If default expr could contain any vars, we'd need to - * fix 'em, but it can't; so default is ready to apply to - * child. - * - * If we already had a default from some prior parent, check - * to see if they are the same. If so, no problem; if - * not, mark the column as having a bogus default. Below, - * we will complain if the bogus default isn't overridden - * by the child schema. - */ - Assert(def->raw_default == NULL); - if (def->cooked_default == NULL) - def->cooked_default = pstrdup(this_default); - else if (strcmp(def->cooked_default, this_default) != 0) - { - def->cooked_default = bogus_marker; - have_bogus_defaults = true; - } - } - } - - /* - * Now copy the constraints of this parent, adjusting attnos using - * the completed newattno[] map - */ - if (constr && constr->num_check > 0) - { - ConstrCheck *check = constr->check; - int i; - - for (i = 0; i < constr->num_check; i++) - { - Constraint *cdef = makeNode(Constraint); - Node *expr; - - cdef->contype = CONSTR_CHECK; - if (check[i].ccname[0] == '$') - cdef->name = NULL; - else - cdef->name = pstrdup(check[i].ccname); - cdef->raw_expr = NULL; - /* adjust varattnos of ccbin here */ - expr = stringToNode(check[i].ccbin); - change_varattnos_of_a_node(expr, newattno); - cdef->cooked_expr = nodeToString(expr); - constraints = lappend(constraints, cdef); - } - } - - pfree(newattno); - - /* - * Close the parent rel, but keep our AccessShareLock on it until - * xact commit. That will prevent someone else from deleting or - * ALTERing the parent before the child is committed. - */ - heap_close(relation, NoLock); - } - - /* - * If we had no inherited attributes, the result schema is just the - * explicitly declared columns. Otherwise, we need to merge the - * declared columns into the inherited schema list. - */ - if (inhSchema != NIL) - { - foreach(entry, schema) - { - ColumnDef *newdef = lfirst(entry); - char *attributeName = newdef->colname; - int exist_attno; - - /* - * Does it conflict with some previously inherited column? - */ - exist_attno = findAttrByName(attributeName, inhSchema); - if (exist_attno > 0) - { - ColumnDef *def; - - /* - * Yes, try to merge the two column definitions. They must - * have the same type and typmod. - */ - elog(NOTICE, "CREATE TABLE: merging attribute \"%s\" with inherited definition", - attributeName); - def = (ColumnDef *) nth(exist_attno - 1, inhSchema); - if (typenameTypeId(def->typename) != typenameTypeId(newdef->typename) || - def->typename->typmod != newdef->typename->typmod) - elog(ERROR, "CREATE TABLE: attribute \"%s\" type conflict (%s and %s)", - attributeName, - TypeNameToString(def->typename), - TypeNameToString(newdef->typename)); - /* Merge of NOT NULL constraints = OR 'em together */ - def->is_not_null |= newdef->is_not_null; - /* If new def has a default, override previous default */ - if (newdef->raw_default != NULL) - { - def->raw_default = newdef->raw_default; - def->cooked_default = newdef->cooked_default; - } - } - else - { - /* - * No, attach new column to result schema - */ - inhSchema = lappend(inhSchema, newdef); - } - } - - schema = inhSchema; - } - - /* - * If we found any conflicting parent default values, check to make - * sure they were overridden by the child. - */ - if (have_bogus_defaults) - { - foreach(entry, schema) - { - ColumnDef *def = lfirst(entry); - - if (def->cooked_default == bogus_marker) - elog(ERROR, "CREATE TABLE: attribute \"%s\" inherits conflicting default values" - "\n\tTo resolve the conflict, specify a default explicitly", - def->colname); - } - } - - *supOids = parentOids; - *supconstr = constraints; - *supHasOids = parentHasOids; - return schema; -} - -/* - * complementary static functions for MergeAttributes(). - * - * Varattnos of pg_relcheck.rcbin must be rewritten when subclasses inherit - * constraints from parent classes, since the inherited attributes could - * be given different column numbers in multiple-inheritance cases. - * - * Note that the passed node tree is modified in place! - */ -static bool -change_varattnos_walker(Node *node, const AttrNumber *newattno) -{ - if (node == NULL) - return false; - if (IsA(node, Var)) - { - Var *var = (Var *) node; - - if (var->varlevelsup == 0 && var->varno == 1 && - var->varattno > 0) - { - /* - * ??? the following may be a problem when the node is - * multiply referenced though stringToNode() doesn't create - * such a node currently. - */ - Assert(newattno[var->varattno - 1] > 0); - var->varattno = newattno[var->varattno - 1]; - } - return false; - } - return expression_tree_walker(node, change_varattnos_walker, - (void *) newattno); -} - -static bool -change_varattnos_of_a_node(Node *node, const AttrNumber *newattno) -{ - return change_varattnos_walker(node, newattno); -} - -/* - * StoreCatalogInheritance - * Updates the system catalogs with proper inheritance information. - * - * supers is an integer list of the OIDs of the new relation's direct - * ancestors. NB: it is destructively changed to include indirect ancestors. - */ -static void -StoreCatalogInheritance(Oid relationId, List *supers) -{ - Relation relation; - TupleDesc desc; - int16 seqNumber; - List *entry; - HeapTuple tuple; - - /* - * sanity checks - */ - AssertArg(OidIsValid(relationId)); - - if (supers == NIL) - return; - - /* - * Catalog INHERITS information using direct ancestors only. - */ - relation = heap_openr(InheritsRelationName, RowExclusiveLock); - desc = RelationGetDescr(relation); - - seqNumber = 1; - foreach(entry, supers) - { - Oid entryOid = lfirsti(entry); - Datum datum[Natts_pg_inherits]; - char nullarr[Natts_pg_inherits]; - - datum[0] = ObjectIdGetDatum(relationId); /* inhrel */ - datum[1] = ObjectIdGetDatum(entryOid); /* inhparent */ - datum[2] = Int16GetDatum(seqNumber); /* inhseqno */ - - nullarr[0] = ' '; - nullarr[1] = ' '; - nullarr[2] = ' '; - - tuple = heap_formtuple(desc, datum, nullarr); - - simple_heap_insert(relation, tuple); - - if (RelationGetForm(relation)->relhasindex) - { - Relation idescs[Num_pg_inherits_indices]; - - CatalogOpenIndices(Num_pg_inherits_indices, Name_pg_inherits_indices, idescs); - CatalogIndexInsert(idescs, Num_pg_inherits_indices, relation, tuple); - CatalogCloseIndices(Num_pg_inherits_indices, idescs); - } - - heap_freetuple(tuple); - - seqNumber += 1; - } - - heap_close(relation, RowExclusiveLock); - - /* ---------------- - * Expand supers list to include indirect ancestors as well. - * - * Algorithm: - * 0. begin with list of direct superclasses. - * 1. append after each relationId, its superclasses, recursively. - * 2. remove all but last of duplicates. - * ---------------- - */ - - /* - * 1. append after each relationId, its superclasses, recursively. - */ - foreach(entry, supers) - { - HeapTuple tuple; - Oid id; - int16 number; - List *next; - List *current; - - id = (Oid) lfirsti(entry); - current = entry; - next = lnext(entry); - - for (number = 1;; number += 1) - { - tuple = SearchSysCache(INHRELID, - ObjectIdGetDatum(id), - Int16GetDatum(number), - 0, 0); - if (!HeapTupleIsValid(tuple)) - break; - - lnext(current) = lconsi(((Form_pg_inherits) - GETSTRUCT(tuple))->inhparent, - NIL); - - ReleaseSysCache(tuple); - - current = lnext(current); - } - lnext(current) = next; - } - - /* - * 2. remove all but last of duplicates. - */ - foreach(entry, supers) - { - Oid thisone; - bool found; - List *rest; - -again: - thisone = lfirsti(entry); - found = false; - foreach(rest, lnext(entry)) - { - if (thisone == lfirsti(rest)) - { - found = true; - break; - } - } - if (found) - { - /* - * found a later duplicate, so remove this entry. - */ - lfirsti(entry) = lfirsti(lnext(entry)); - lnext(entry) = lnext(lnext(entry)); - - goto again; - } - } -} - -/* - * Look for an existing schema entry with the given name. - * - * Returns the index (starting with 1) if attribute already exists in schema, - * 0 if it doesn't. - */ -static int -findAttrByName(const char *attributeName, List *schema) -{ - List *s; - int i = 0; - - foreach(s, schema) - { - ColumnDef *def = lfirst(s); - - ++i; - if (strcmp(attributeName, def->colname) == 0) - return i; - } - return 0; -} - -/* - * Update a relation's pg_class.relhassubclass entry to the given value - */ -static void -setRelhassubclassInRelation(Oid relationId, bool relhassubclass) -{ - Relation relationRelation; - HeapTuple tuple; - Relation idescs[Num_pg_class_indices]; - - /* - * Fetch a modifiable copy of the tuple, modify it, update pg_class. - */ - relationRelation = heap_openr(RelationRelationName, RowExclusiveLock); - tuple = SearchSysCacheCopy(RELOID, - ObjectIdGetDatum(relationId), - 0, 0, 0); - if (!HeapTupleIsValid(tuple)) - elog(ERROR, "setRelhassubclassInRelation: cache lookup failed for relation %u", relationId); - - ((Form_pg_class) GETSTRUCT(tuple))->relhassubclass = relhassubclass; - simple_heap_update(relationRelation, &tuple->t_self, tuple); - - /* keep the catalog indices up to date */ - CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, idescs); - CatalogIndexInsert(idescs, Num_pg_class_indices, relationRelation, tuple); - CatalogCloseIndices(Num_pg_class_indices, idescs); - - heap_freetuple(tuple); - heap_close(relationRelation, RowExclusiveLock); -} - - -/* - * renameatt - changes the name of a attribute in a relation - * - * Attname attribute is changed in attribute catalog. - * No record of the previous attname is kept (correct?). - * - * get proper relrelation from relation catalog (if not arg) - * scan attribute catalog - * for name conflict (within rel) - * for original attribute (if not arg) - * modify attname in attribute tuple - * insert modified attribute in attribute catalog - * delete original attribute from attribute catalog - */ -void -renameatt(Oid relid, - const char *oldattname, - const char *newattname, - bool recurse) -{ - Relation targetrelation; - Relation attrelation; - HeapTuple atttup; - List *indexoidlist; - List *indexoidscan; - - /* - * Grab an exclusive lock on the target table, which we will NOT - * release until end of transaction. - */ - targetrelation = heap_open(relid, AccessExclusiveLock); - - /* - * permissions checking. this would normally be done in utility.c, - * but this particular routine is recursive. - * - * normally, only the owner of a class can change its schema. - */ - if (!allowSystemTableMods - && IsSystemRelation(targetrelation)) - elog(ERROR, "renameatt: class \"%s\" is a system catalog", - RelationGetRelationName(targetrelation)); - if (!pg_class_ownercheck(relid, GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, - RelationGetRelationName(targetrelation)); - - /* - * if the 'recurse' flag is set then we are supposed to rename this - * attribute in all classes that inherit from 'relname' (as well as in - * 'relname'). - * - * any permissions or problems with duplicate attributes will cause the - * whole transaction to abort, which is what we want -- all or - * nothing. - */ - if (recurse) - { - List *child, - *children; - - /* this routine is actually in the planner */ - children = find_all_inheritors(relid); - - /* - * find_all_inheritors does the recursive search of the - * inheritance hierarchy, so all we have to do is process all of - * the relids in the list that it returns. - */ - foreach(child, children) - { - Oid childrelid = lfirsti(child); - - if (childrelid == relid) - continue; - /* note we need not recurse again! */ - renameatt(childrelid, oldattname, newattname, false); - } - } - - attrelation = heap_openr(AttributeRelationName, RowExclusiveLock); - - atttup = SearchSysCacheCopy(ATTNAME, - ObjectIdGetDatum(relid), - PointerGetDatum(oldattname), - 0, 0); - if (!HeapTupleIsValid(atttup)) - elog(ERROR, "renameatt: attribute \"%s\" does not exist", oldattname); - - if (((Form_pg_attribute) GETSTRUCT(atttup))->attnum < 0) - elog(ERROR, "renameatt: system attribute \"%s\" not renamed", oldattname); - - /* should not already exist */ - if (SearchSysCacheExists(ATTNAME, - ObjectIdGetDatum(relid), - PointerGetDatum(newattname), - 0, 0)) - elog(ERROR, "renameatt: attribute \"%s\" exists", newattname); - - namestrcpy(&(((Form_pg_attribute) GETSTRUCT(atttup))->attname), - newattname); - - simple_heap_update(attrelation, &atttup->t_self, atttup); - - /* keep system catalog indices current */ - { - Relation irelations[Num_pg_attr_indices]; - - CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, irelations); - CatalogIndexInsert(irelations, Num_pg_attr_indices, attrelation, atttup); - CatalogCloseIndices(Num_pg_attr_indices, irelations); - } - - heap_freetuple(atttup); - - /* - * Update column names of indexes that refer to the column being - * renamed. - */ - indexoidlist = RelationGetIndexList(targetrelation); - - foreach(indexoidscan, indexoidlist) - { - Oid indexoid = lfirsti(indexoidscan); - HeapTuple indextup; - - /* - * First check to see if index is a functional index. If so, its - * column name is a function name and shouldn't be renamed here. - */ - indextup = SearchSysCache(INDEXRELID, - ObjectIdGetDatum(indexoid), - 0, 0, 0); - if (!HeapTupleIsValid(indextup)) - elog(ERROR, "renameatt: can't find index id %u", indexoid); - if (OidIsValid(((Form_pg_index) GETSTRUCT(indextup))->indproc)) - { - ReleaseSysCache(indextup); - continue; - } - ReleaseSysCache(indextup); - - /* - * Okay, look to see if any column name of the index matches the - * old attribute name. - */ - atttup = SearchSysCacheCopy(ATTNAME, - ObjectIdGetDatum(indexoid), - PointerGetDatum(oldattname), - 0, 0); - if (!HeapTupleIsValid(atttup)) - continue; /* Nope, so ignore it */ - - /* - * Update the (copied) attribute tuple. - */ - namestrcpy(&(((Form_pg_attribute) GETSTRUCT(atttup))->attname), - newattname); - - simple_heap_update(attrelation, &atttup->t_self, atttup); - - /* keep system catalog indices current */ - { - Relation irelations[Num_pg_attr_indices]; - - CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, irelations); - CatalogIndexInsert(irelations, Num_pg_attr_indices, attrelation, atttup); - CatalogCloseIndices(Num_pg_attr_indices, irelations); - } - heap_freetuple(atttup); - } - - freeList(indexoidlist); - - heap_close(attrelation, RowExclusiveLock); - - /* - * Update att name in any RI triggers associated with the relation. - */ - if (targetrelation->rd_rel->reltriggers > 0) - { - /* update tgargs column reference where att is primary key */ - update_ri_trigger_args(RelationGetRelid(targetrelation), - oldattname, newattname, - false, false); - /* update tgargs column reference where att is foreign key */ - update_ri_trigger_args(RelationGetRelid(targetrelation), - oldattname, newattname, - true, false); - } - - heap_close(targetrelation, NoLock); /* close rel but keep lock! */ -} - -/* - * renamerel - change the name of a relation - * - * XXX - When renaming sequences, we don't bother to modify the - * sequence name that is stored within the sequence itself - * (this would cause problems with MVCC). In the future, - * the sequence name should probably be removed from the - * sequence, AFAIK there's no need for it to be there. - */ -void -renamerel(Oid relid, const char *newrelname) -{ - Relation targetrelation; - Relation relrelation; /* for RELATION relation */ - HeapTuple reltup; - Oid namespaceId; - char *oldrelname; - char relkind; - bool relhastriggers; - Relation irelations[Num_pg_class_indices]; - - /* - * Grab an exclusive lock on the target table or index, which we will - * NOT release until end of transaction. - */ - targetrelation = relation_open(relid, AccessExclusiveLock); - - oldrelname = pstrdup(RelationGetRelationName(targetrelation)); - namespaceId = RelationGetNamespace(targetrelation); - - /* Validity checks */ - if (!allowSystemTableMods && - IsSystemRelation(targetrelation)) - elog(ERROR, "renamerel: system relation \"%s\" may not be renamed", - oldrelname); - - relkind = targetrelation->rd_rel->relkind; - relhastriggers = (targetrelation->rd_rel->reltriggers > 0); - - /* - * Find relation's pg_class tuple, and make sure newrelname isn't in - * use. - */ - relrelation = heap_openr(RelationRelationName, RowExclusiveLock); - - reltup = SearchSysCacheCopy(RELOID, - PointerGetDatum(relid), - 0, 0, 0); - if (!HeapTupleIsValid(reltup)) - elog(ERROR, "renamerel: relation \"%s\" does not exist", - oldrelname); - - if (get_relname_relid(newrelname, namespaceId) != InvalidOid) - elog(ERROR, "renamerel: relation \"%s\" exists", newrelname); - - /* - * Update pg_class tuple with new relname. (Scribbling on reltup is - * OK because it's a copy...) - */ - namestrcpy(&(((Form_pg_class) GETSTRUCT(reltup))->relname), newrelname); - - simple_heap_update(relrelation, &reltup->t_self, reltup); - - /* keep the system catalog indices current */ - CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, irelations); - CatalogIndexInsert(irelations, Num_pg_class_indices, relrelation, reltup); - CatalogCloseIndices(Num_pg_class_indices, irelations); - - heap_close(relrelation, NoLock); - heap_freetuple(reltup); - - /* - * Also rename the associated type, if any. - */ - if (relkind != RELKIND_INDEX) - TypeRename(oldrelname, namespaceId, newrelname); - - /* - * Update rel name in any RI triggers associated with the relation. - */ - if (relhastriggers) - { - /* update tgargs where relname is primary key */ - update_ri_trigger_args(relid, - oldrelname, - newrelname, - false, true); - /* update tgargs where relname is foreign key */ - update_ri_trigger_args(relid, - oldrelname, - newrelname, - true, true); - } - - /* - * Close rel, but keep exclusive lock! - */ - relation_close(targetrelation, NoLock); -} - - -/* - * Given a trigger function OID, determine whether it is an RI trigger, - * and if so whether it is attached to PK or FK relation. - * - * XXX this probably doesn't belong here; should be exported by - * ri_triggers.c - */ -static int -ri_trigger_type(Oid tgfoid) -{ - switch (tgfoid) - { - case F_RI_FKEY_CASCADE_DEL: - case F_RI_FKEY_CASCADE_UPD: - case F_RI_FKEY_RESTRICT_DEL: - case F_RI_FKEY_RESTRICT_UPD: - case F_RI_FKEY_SETNULL_DEL: - case F_RI_FKEY_SETNULL_UPD: - case F_RI_FKEY_SETDEFAULT_DEL: - case F_RI_FKEY_SETDEFAULT_UPD: - case F_RI_FKEY_NOACTION_DEL: - case F_RI_FKEY_NOACTION_UPD: - return RI_TRIGGER_PK; - - case F_RI_FKEY_CHECK_INS: - case F_RI_FKEY_CHECK_UPD: - return RI_TRIGGER_FK; - } - - return RI_TRIGGER_NONE; -} - -/* - * Scan pg_trigger for RI triggers that are on the specified relation - * (if fk_scan is false) or have it as the tgconstrrel (if fk_scan - * is true). Update RI trigger args fields matching oldname to contain - * newname instead. If update_relname is true, examine the relname - * fields; otherwise examine the attname fields. - */ -static void -update_ri_trigger_args(Oid relid, - const char *oldname, - const char *newname, - bool fk_scan, - bool update_relname) -{ - Relation tgrel; - ScanKeyData skey[1]; - SysScanDesc trigscan; - HeapTuple tuple; - Datum values[Natts_pg_trigger]; - char nulls[Natts_pg_trigger]; - char replaces[Natts_pg_trigger]; - - tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); - if (fk_scan) - { - ScanKeyEntryInitialize(&skey[0], 0x0, - Anum_pg_trigger_tgconstrrelid, - F_OIDEQ, - ObjectIdGetDatum(relid)); - trigscan = systable_beginscan(tgrel, TriggerConstrRelidIndex, - true, SnapshotNow, - 1, skey); - } - else - { - ScanKeyEntryInitialize(&skey[0], 0x0, - Anum_pg_trigger_tgrelid, - F_OIDEQ, - ObjectIdGetDatum(relid)); - trigscan = systable_beginscan(tgrel, TriggerRelidNameIndex, - true, SnapshotNow, - 1, skey); - } - - while ((tuple = systable_getnext(trigscan)) != NULL) - { - Form_pg_trigger pg_trigger = (Form_pg_trigger) GETSTRUCT(tuple); - bytea *val; - bytea *newtgargs; - bool isnull; - int tg_type; - bool examine_pk; - bool changed; - int tgnargs; - int i; - int newlen; - const char *arga[RI_MAX_ARGUMENTS]; - const char *argp; - - tg_type = ri_trigger_type(pg_trigger->tgfoid); - if (tg_type == RI_TRIGGER_NONE) - { - /* Not an RI trigger, forget it */ - continue; - } - - /* - * It is an RI trigger, so parse the tgargs bytea. - * - * NB: we assume the field will never be compressed or moved out of - * line; so does trigger.c ... - */ - tgnargs = pg_trigger->tgnargs; - val = (bytea *) fastgetattr(tuple, - Anum_pg_trigger_tgargs, - tgrel->rd_att, &isnull); - if (isnull || tgnargs < RI_FIRST_ATTNAME_ARGNO || - tgnargs > RI_MAX_ARGUMENTS) - { - /* This probably shouldn't happen, but ignore busted triggers */ - continue; - } - argp = (const char *) VARDATA(val); - for (i = 0; i < tgnargs; i++) - { - arga[i] = argp; - argp += strlen(argp) + 1; - } - - /* - * Figure out which item(s) to look at. If the trigger is - * primary-key type and attached to my rel, I should look at the - * PK fields; if it is foreign-key type and attached to my rel, I - * should look at the FK fields. But the opposite rule holds when - * examining triggers found by tgconstrrel search. - */ - examine_pk = (tg_type == RI_TRIGGER_PK) == (!fk_scan); - - changed = false; - if (update_relname) - { - /* Change the relname if needed */ - i = examine_pk ? RI_PK_RELNAME_ARGNO : RI_FK_RELNAME_ARGNO; - if (strcmp(arga[i], oldname) == 0) - { - arga[i] = newname; - changed = true; - } - } - else - { - /* Change attname(s) if needed */ - i = examine_pk ? RI_FIRST_ATTNAME_ARGNO + RI_KEYPAIR_PK_IDX : - RI_FIRST_ATTNAME_ARGNO + RI_KEYPAIR_FK_IDX; - for (; i < tgnargs; i += 2) - { - if (strcmp(arga[i], oldname) == 0) - { - arga[i] = newname; - changed = true; - } - } - } - - if (!changed) - { - /* Don't need to update this tuple */ - continue; - } - - /* - * Construct modified tgargs bytea. - */ - newlen = VARHDRSZ; - for (i = 0; i < tgnargs; i++) - newlen += strlen(arga[i]) + 1; - newtgargs = (bytea *) palloc(newlen); - VARATT_SIZEP(newtgargs) = newlen; - newlen = VARHDRSZ; - for (i = 0; i < tgnargs; i++) - { - strcpy(((char *) newtgargs) + newlen, arga[i]); - newlen += strlen(arga[i]) + 1; - } - - /* - * Build modified tuple. - */ - for (i = 0; i < Natts_pg_trigger; i++) - { - values[i] = (Datum) 0; - replaces[i] = ' '; - nulls[i] = ' '; - } - values[Anum_pg_trigger_tgargs - 1] = PointerGetDatum(newtgargs); - replaces[Anum_pg_trigger_tgargs - 1] = 'r'; - - tuple = heap_modifytuple(tuple, tgrel, values, nulls, replaces); - - /* - * Update pg_trigger and its indexes - */ - simple_heap_update(tgrel, &tuple->t_self, tuple); - - { - Relation irelations[Num_pg_attr_indices]; - - CatalogOpenIndices(Num_pg_trigger_indices, Name_pg_trigger_indices, irelations); - CatalogIndexInsert(irelations, Num_pg_trigger_indices, tgrel, tuple); - CatalogCloseIndices(Num_pg_trigger_indices, irelations); - } - - /* free up our scratch memory */ - pfree(newtgargs); - heap_freetuple(tuple); - } - - systable_endscan(trigscan); - - heap_close(tgrel, RowExclusiveLock); - - /* - * Increment cmd counter to make updates visible; this is needed in - * case the same tuple has to be updated again by next pass (can - * happen in case of a self-referential FK relationship). - */ - CommandCounterIncrement(); -} - - -/* ---------------- - * AlterTableAddColumn - * (formerly known as PerformAddAttribute) - * - * adds an additional attribute to a relation - * - * Adds attribute field(s) to a relation. Each new attribute - * is given attnums in sequential order and is added to the - * ATTRIBUTE relation. If the AMI fails, defunct tuples will - * remain in the ATTRIBUTE relation for later vacuuming. - * Later, there may be some reserved attribute names??? - * - * (If needed, can instead use elog to handle exceptions.) - * - * Note: - * Initial idea of ordering the tuple attributes so that all - * the variable length domains occured last was scratched. Doing - * so would not speed access too much (in general) and would create - * many complications in formtuple, heap_getattr, and addattribute. - * - * scan attribute catalog for name conflict (within rel) - * scan type catalog for absence of data type (if not arg) - * create attnum magically??? - * create attribute tuple - * insert attribute in attribute catalog - * modify reldesc - * create new relation tuple - * insert new relation in relation catalog - * delete original relation from relation catalog - * ---------------- - */ -void -AlterTableAddColumn(Oid myrelid, - bool inherits, - ColumnDef *colDef) -{ - Relation rel, - pgclass, - attrdesc; - HeapTuple reltup; - HeapTuple newreltup; - HeapTuple attributeTuple; - Form_pg_attribute attribute; - FormData_pg_attribute attributeD; - int i; - int minattnum, - maxatts; - HeapTuple typeTuple; - Form_pg_type tform; - int attndims; - - /* - * Grab an exclusive lock on the target table, which we will NOT - * release until end of transaction. - */ - rel = heap_open(myrelid, AccessExclusiveLock); - - if (rel->rd_rel->relkind != RELKIND_RELATION) - elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table", - RelationGetRelationName(rel)); - - /* - * permissions checking. this would normally be done in utility.c, - * but this particular routine is recursive. - * - * normally, only the owner of a class can change its schema. - */ - if (!allowSystemTableMods - && IsSystemRelation(rel)) - elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", - RelationGetRelationName(rel)); - if (!pg_class_ownercheck(myrelid, GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(rel)); - - /* - * Recurse to add the column to child classes, if requested. - * - * any permissions or problems with duplicate attributes will cause the - * whole transaction to abort, which is what we want -- all or - * nothing. - */ - if (inherits) - { - List *child, - *children; - - /* this routine is actually in the planner */ - children = find_all_inheritors(myrelid); - - /* - * find_all_inheritors does the recursive search of the - * inheritance hierarchy, so all we have to do is process all of - * the relids in the list that it returns. - */ - foreach(child, children) - { - Oid childrelid = lfirsti(child); - - if (childrelid == myrelid) - continue; - - AlterTableAddColumn(childrelid, false, colDef); - } - } - - /* - * OK, get on with it... - * - * Implementation restrictions: because we don't touch the table rows, - * the new column values will initially appear to be NULLs. (This - * happens because the heap tuple access routines always check for - * attnum > # of attributes in tuple, and return NULL if so.) - * Therefore we can't support a DEFAULT value in SQL92-compliant - * fashion, and we also can't allow a NOT NULL constraint. - * - * We do allow CHECK constraints, even though these theoretically could - * fail for NULL rows (eg, CHECK (newcol IS NOT NULL)). - */ - if (colDef->raw_default || colDef->cooked_default) - elog(ERROR, "Adding columns with defaults is not implemented." - "\n\tAdd the column, then use ALTER TABLE SET DEFAULT."); - - if (colDef->is_not_null) - elog(ERROR, "Adding NOT NULL columns is not implemented." - "\n\tAdd the column, then use ALTER TABLE ... SET NOT NULL."); - - pgclass = heap_openr(RelationRelationName, RowExclusiveLock); - - reltup = SearchSysCache(RELOID, - ObjectIdGetDatum(myrelid), - 0, 0, 0); - if (!HeapTupleIsValid(reltup)) - elog(ERROR, "ALTER TABLE: relation \"%s\" not found", - RelationGetRelationName(rel)); - - if (SearchSysCacheExists(ATTNAME, - ObjectIdGetDatum(myrelid), - PointerGetDatum(colDef->colname), - 0, 0)) - elog(ERROR, "ALTER TABLE: column name \"%s\" already exists in table \"%s\"", - colDef->colname, RelationGetRelationName(rel)); - - minattnum = ((Form_pg_class) GETSTRUCT(reltup))->relnatts; - maxatts = minattnum + 1; - if (maxatts > MaxHeapAttributeNumber) - elog(ERROR, "ALTER TABLE: relations limited to %d columns", - MaxHeapAttributeNumber); - i = minattnum + 1; - - attrdesc = heap_openr(AttributeRelationName, RowExclusiveLock); - - if (colDef->typename->arrayBounds) - attndims = length(colDef->typename->arrayBounds); - else - attndims = 0; - - typeTuple = typenameType(colDef->typename); - tform = (Form_pg_type) GETSTRUCT(typeTuple); - - attributeTuple = heap_addheader(Natts_pg_attribute, - ATTRIBUTE_TUPLE_SIZE, - (void *) &attributeD); - - attribute = (Form_pg_attribute) GETSTRUCT(attributeTuple); - - attribute->attrelid = myrelid; - namestrcpy(&(attribute->attname), colDef->colname); - attribute->atttypid = typeTuple->t_data->t_oid; - attribute->attstattarget = DEFAULT_ATTSTATTARGET; - attribute->attlen = tform->typlen; - attribute->attcacheoff = -1; - attribute->atttypmod = colDef->typename->typmod; - attribute->attnum = i; - attribute->attbyval = tform->typbyval; - attribute->attndims = attndims; - attribute->attisset = (bool) (tform->typtype == 'c'); - attribute->attstorage = tform->typstorage; - attribute->attalign = tform->typalign; - attribute->attnotnull = colDef->is_not_null; - attribute->atthasdef = (colDef->raw_default != NULL || - colDef->cooked_default != NULL); - - ReleaseSysCache(typeTuple); - - simple_heap_insert(attrdesc, attributeTuple); - - /* Update indexes on pg_attribute */ - if (RelationGetForm(attrdesc)->relhasindex) - { - Relation idescs[Num_pg_attr_indices]; - - CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, idescs); - CatalogIndexInsert(idescs, Num_pg_attr_indices, attrdesc, attributeTuple); - CatalogCloseIndices(Num_pg_attr_indices, idescs); - } - - heap_close(attrdesc, RowExclusiveLock); - - /* - * Update number of attributes in pg_class tuple - */ - newreltup = heap_copytuple(reltup); - - ((Form_pg_class) GETSTRUCT(newreltup))->relnatts = maxatts; - simple_heap_update(pgclass, &newreltup->t_self, newreltup); - - /* keep catalog indices current */ - if (RelationGetForm(pgclass)->relhasindex) - { - Relation ridescs[Num_pg_class_indices]; - - CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs); - CatalogIndexInsert(ridescs, Num_pg_class_indices, pgclass, newreltup); - CatalogCloseIndices(Num_pg_class_indices, ridescs); - } - - heap_freetuple(newreltup); - ReleaseSysCache(reltup); - - heap_close(pgclass, NoLock); - - heap_close(rel, NoLock); /* close rel but keep lock! */ - - /* - * Make our catalog updates visible for subsequent steps. - */ - CommandCounterIncrement(); - - /* - * Add any CHECK constraints attached to the new column. - * - * To do this we must re-open the rel so that its new attr list gets - * loaded into the relcache. - */ - if (colDef->constraints != NIL) - { - rel = heap_open(myrelid, AccessExclusiveLock); - AddRelationRawConstraints(rel, NIL, colDef->constraints); - heap_close(rel, NoLock); - } - - /* - * Automatically create the secondary relation for TOAST if it - * formerly had no such but now has toastable attributes. - */ - AlterTableCreateToastTable(myrelid, true); -} - -/* - * ALTER TABLE ALTER COLUMN DROP NOT NULL - */ -void -AlterTableAlterColumnDropNotNull(Oid myrelid, - bool inh, const char *colName) -{ - Relation rel; - HeapTuple tuple; - AttrNumber attnum; - Relation attr_rel; - List *indexoidlist; - List *indexoidscan; - - rel = heap_open(myrelid, AccessExclusiveLock); - - if (rel->rd_rel->relkind != RELKIND_RELATION) - elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table", - RelationGetRelationName(rel)); - - if (!allowSystemTableMods - && IsSystemRelation(rel)) - elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", - RelationGetRelationName(rel)); - - if (!pg_class_ownercheck(myrelid, GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(rel)); - - /* - * Propagate to children if desired - */ - if (inh) - { - List *child, - *children; - - /* this routine is actually in the planner */ - children = find_all_inheritors(myrelid); - - /* - * find_all_inheritors does the recursive search of the - * inheritance hierarchy, so all we have to do is process all of - * the relids in the list that it returns. - */ - foreach(child, children) - { - Oid childrelid = lfirsti(child); - - if (childrelid == myrelid) - continue; - AlterTableAlterColumnDropNotNull(childrelid, - false, colName); - } - } - - /* -= now do the thing on this relation =- */ - - /* - * get the number of the attribute - */ - tuple = SearchSysCache(ATTNAME, - ObjectIdGetDatum(myrelid), - PointerGetDatum(colName), - 0, 0); - if (!HeapTupleIsValid(tuple)) - elog(ERROR, "ALTER TABLE: relation \"%s\" has no column \"%s\"", - RelationGetRelationName(rel), colName); - - attnum = ((Form_pg_attribute) GETSTRUCT(tuple))->attnum; - ReleaseSysCache(tuple); - - /* Prevent them from altering a system attribute */ - if (attnum < 0) - elog(ERROR, "ALTER TABLE: Cannot alter system attribute \"%s\"", - colName); - - /* - * Check that the attribute is not in a primary key - */ - - /* Loop over all indices on the relation */ - indexoidlist = RelationGetIndexList(rel); - - foreach(indexoidscan, indexoidlist) - { - Oid indexoid = lfirsti(indexoidscan); - HeapTuple indexTuple; - Form_pg_index indexStruct; - int i; - - indexTuple = SearchSysCache(INDEXRELID, - ObjectIdGetDatum(indexoid), - 0, 0, 0); - if (!HeapTupleIsValid(indexTuple)) - elog(ERROR, "ALTER TABLE: Index %u not found", - indexoid); - indexStruct = (Form_pg_index) GETSTRUCT(indexTuple); - - /* If the index is not a primary key, skip the check */ - if (indexStruct->indisprimary) - { - /* - * Loop over each attribute in the primary key and - * see if it matches the to-be-altered attribute - */ - for (i = 0; i < INDEX_MAX_KEYS && - indexStruct->indkey[i] != InvalidAttrNumber; i++) - { - if (indexStruct->indkey[i] == attnum) - elog(ERROR, "ALTER TABLE: Attribute \"%s\" is in a primary key", colName); - } - } - - ReleaseSysCache(indexTuple); - } - - freeList(indexoidlist); - - /* - * Okay, actually perform the catalog change - */ - attr_rel = heap_openr(AttributeRelationName, RowExclusiveLock); - - tuple = SearchSysCacheCopy(ATTNAME, - ObjectIdGetDatum(myrelid), - PointerGetDatum(colName), - 0, 0); - if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ - elog(ERROR, "ALTER TABLE: relation \"%s\" has no column \"%s\"", - RelationGetRelationName(rel), colName); - - ((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = FALSE; - - simple_heap_update(attr_rel, &tuple->t_self, tuple); - - /* keep the system catalog indices current */ - if (RelationGetForm(attr_rel)->relhasindex) - { - Relation idescs[Num_pg_attr_indices]; - - CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, idescs); - CatalogIndexInsert(idescs, Num_pg_attr_indices, attr_rel, tuple); - CatalogCloseIndices(Num_pg_attr_indices, idescs); - } - - heap_close(attr_rel, RowExclusiveLock); - - heap_close(rel, NoLock); -} - -/* - * ALTER TABLE ALTER COLUMN SET NOT NULL - */ -void -AlterTableAlterColumnSetNotNull(Oid myrelid, - bool inh, const char *colName) -{ - Relation rel; - HeapTuple tuple; - AttrNumber attnum; - Relation attr_rel; - HeapScanDesc scan; - TupleDesc tupdesc; - - rel = heap_open(myrelid, AccessExclusiveLock); - - if (rel->rd_rel->relkind != RELKIND_RELATION) - elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table", - RelationGetRelationName(rel)); - - if (!allowSystemTableMods - && IsSystemRelation(rel)) - elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", - RelationGetRelationName(rel)); - - if (!pg_class_ownercheck(myrelid, GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(rel)); - - /* - * Propagate to children if desired - */ - if (inh) - { - List *child, - *children; - - /* this routine is actually in the planner */ - children = find_all_inheritors(myrelid); - - /* - * find_all_inheritors does the recursive search of the - * inheritance hierarchy, so all we have to do is process all of - * the relids in the list that it returns. - */ - foreach(child, children) - { - Oid childrelid = lfirsti(child); - - if (childrelid == myrelid) - continue; - AlterTableAlterColumnSetNotNull(childrelid, - false, colName); - } - } - - /* -= now do the thing on this relation =- */ - - /* - * get the number of the attribute - */ - tuple = SearchSysCache(ATTNAME, - ObjectIdGetDatum(myrelid), - PointerGetDatum(colName), - 0, 0); - if (!HeapTupleIsValid(tuple)) - elog(ERROR, "ALTER TABLE: relation \"%s\" has no column \"%s\"", - RelationGetRelationName(rel), colName); - - attnum = ((Form_pg_attribute) GETSTRUCT(tuple))->attnum; - ReleaseSysCache(tuple); - - /* Prevent them from altering a system attribute */ - if (attnum < 0) - elog(ERROR, "ALTER TABLE: Cannot alter system attribute \"%s\"", - colName); - - /* - * Perform a scan to ensure that there are no NULL - * values already in the relation - */ - tupdesc = RelationGetDescr(rel); - - scan = heap_beginscan(rel, SnapshotNow, 0, NULL); - - while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) - { - Datum d; - bool isnull; - - d = heap_getattr(tuple, attnum, tupdesc, &isnull); - - if (isnull) - elog(ERROR, "ALTER TABLE: Attribute \"%s\" contains NULL values", - colName); - } - - heap_endscan(scan); - - /* - * Okay, actually perform the catalog change - */ - attr_rel = heap_openr(AttributeRelationName, RowExclusiveLock); - - tuple = SearchSysCacheCopy(ATTNAME, - ObjectIdGetDatum(myrelid), - PointerGetDatum(colName), - 0, 0); - if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ - elog(ERROR, "ALTER TABLE: relation \"%s\" has no column \"%s\"", - RelationGetRelationName(rel), colName); - - ((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = TRUE; - - simple_heap_update(attr_rel, &tuple->t_self, tuple); - - /* keep the system catalog indices current */ - if (RelationGetForm(attr_rel)->relhasindex) - { - Relation idescs[Num_pg_attr_indices]; - - CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, idescs); - CatalogIndexInsert(idescs, Num_pg_attr_indices, attr_rel, tuple); - CatalogCloseIndices(Num_pg_attr_indices, idescs); - } - - heap_close(attr_rel, RowExclusiveLock); - - heap_close(rel, NoLock); -} - - -/* - * ALTER TABLE ALTER COLUMN SET/DROP DEFAULT - */ -void -AlterTableAlterColumnDefault(Oid myrelid, - bool inh, const char *colName, - Node *newDefault) -{ - Relation rel; - HeapTuple tuple; - AttrNumber attnum; - - rel = heap_open(myrelid, AccessExclusiveLock); - - /* - * We allow defaults on views so that INSERT into a view can have - * default-ish behavior. This works because the rewriter substitutes - * default values into INSERTs before it expands rules. - */ - if (rel->rd_rel->relkind != RELKIND_RELATION && - rel->rd_rel->relkind != RELKIND_VIEW) - elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table or view", - RelationGetRelationName(rel)); - - if (!allowSystemTableMods - && IsSystemRelation(rel)) - elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", - RelationGetRelationName(rel)); - - if (!pg_class_ownercheck(myrelid, GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(rel)); - - /* - * Propagate to children if desired - */ - if (inh) - { - List *child, - *children; - - /* this routine is actually in the planner */ - children = find_all_inheritors(myrelid); - - /* - * find_all_inheritors does the recursive search of the - * inheritance hierarchy, so all we have to do is process all of - * the relids in the list that it returns. - */ - foreach(child, children) - { - Oid childrelid = lfirsti(child); - - if (childrelid == myrelid) - continue; - AlterTableAlterColumnDefault(childrelid, - false, colName, newDefault); - } - } - - /* -= now do the thing on this relation =- */ - - /* - * get the number of the attribute - */ - tuple = SearchSysCache(ATTNAME, - ObjectIdGetDatum(myrelid), - PointerGetDatum(colName), - 0, 0); - if (!HeapTupleIsValid(tuple)) - elog(ERROR, "ALTER TABLE: relation \"%s\" has no column \"%s\"", - RelationGetRelationName(rel), colName); - - attnum = ((Form_pg_attribute) GETSTRUCT(tuple))->attnum; - ReleaseSysCache(tuple); - - if (newDefault) - { - /* SET DEFAULT */ - RawColumnDefault *rawEnt; - - /* Get rid of the old one first */ - drop_default(myrelid, attnum); - - rawEnt = (RawColumnDefault *) palloc(sizeof(RawColumnDefault)); - rawEnt->attnum = attnum; - rawEnt->raw_default = newDefault; - - /* - * This function is intended for CREATE TABLE, so it processes a - * _list_ of defaults, but we just do one. - */ - AddRelationRawConstraints(rel, makeList1(rawEnt), NIL); - } - else - { - /* DROP DEFAULT */ - Relation attr_rel; - - /* Fix the pg_attribute row */ - attr_rel = heap_openr(AttributeRelationName, RowExclusiveLock); - - tuple = SearchSysCacheCopy(ATTNAME, - ObjectIdGetDatum(myrelid), - PointerGetDatum(colName), - 0, 0); - if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ - elog(ERROR, "ALTER TABLE: relation \"%s\" has no column \"%s\"", - RelationGetRelationName(rel), colName); - - ((Form_pg_attribute) GETSTRUCT(tuple))->atthasdef = FALSE; - - simple_heap_update(attr_rel, &tuple->t_self, tuple); - - /* keep the system catalog indices current */ - if (RelationGetForm(attr_rel)->relhasindex) - { - Relation idescs[Num_pg_attr_indices]; - - CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, idescs); - CatalogIndexInsert(idescs, Num_pg_attr_indices, attr_rel, tuple); - CatalogCloseIndices(Num_pg_attr_indices, idescs); - } - - heap_close(attr_rel, RowExclusiveLock); - - /* get rid of actual default definition in pg_attrdef */ - drop_default(myrelid, attnum); - } - - heap_close(rel, NoLock); -} - - -static void -drop_default(Oid relid, int16 attnum) -{ - ScanKeyData scankeys[2]; - HeapScanDesc scan; - Relation attrdef_rel; - HeapTuple tuple; - - attrdef_rel = heap_openr(AttrDefaultRelationName, RowExclusiveLock); - ScanKeyEntryInitialize(&scankeys[0], 0x0, - Anum_pg_attrdef_adrelid, F_OIDEQ, - ObjectIdGetDatum(relid)); - ScanKeyEntryInitialize(&scankeys[1], 0x0, - Anum_pg_attrdef_adnum, F_INT2EQ, - Int16GetDatum(attnum)); - - scan = heap_beginscan(attrdef_rel, SnapshotNow, 2, scankeys); - - if ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) - simple_heap_delete(attrdef_rel, &tuple->t_self); - - heap_endscan(scan); - - heap_close(attrdef_rel, NoLock); -} - - -/* - * ALTER TABLE ALTER COLUMN SET STATISTICS / STORAGE - */ -void -AlterTableAlterColumnFlags(Oid myrelid, - bool inh, const char *colName, - Node *flagValue, const char *flagType) -{ - Relation rel; - int newtarget = 1; - char newstorage = 'p'; - Relation attrelation; - HeapTuple tuple; - Form_pg_attribute attrtuple; - - rel = heap_open(myrelid, AccessExclusiveLock); - - if (rel->rd_rel->relkind != RELKIND_RELATION) - elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table", - RelationGetRelationName(rel)); - - /* - * we allow statistics case for system tables - */ - if (*flagType != 'S' && !allowSystemTableMods && IsSystemRelation(rel)) - elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", - RelationGetRelationName(rel)); - - if (!pg_class_ownercheck(myrelid, GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(rel)); - - /* - * Check the supplied parameters before anything else - */ - if (*flagType == 'S') - { - /* STATISTICS */ - Assert(IsA(flagValue, Integer)); - newtarget = intVal(flagValue); - - /* - * Limit target to sane range (should we raise an error instead?) - */ - if (newtarget < 0) - newtarget = 0; - else if (newtarget > 1000) - newtarget = 1000; - } - else if (*flagType == 'M') - { - /* STORAGE */ - char *storagemode; - - Assert(IsA(flagValue, String)); - storagemode = strVal(flagValue); - - if (strcasecmp(storagemode, "plain") == 0) - newstorage = 'p'; - else if (strcasecmp(storagemode, "external") == 0) - newstorage = 'e'; - else if (strcasecmp(storagemode, "extended") == 0) - newstorage = 'x'; - else if (strcasecmp(storagemode, "main") == 0) - newstorage = 'm'; - else - elog(ERROR, "ALTER TABLE: \"%s\" storage not recognized", - storagemode); - } - else - { - elog(ERROR, "ALTER TABLE: Invalid column flag: %c", - (int) *flagType); - } - - /* - * Propagate to children if desired - */ - if (inh) - { - List *child, - *children; - - /* this routine is actually in the planner */ - children = find_all_inheritors(myrelid); - - /* - * find_all_inheritors does the recursive search of the - * inheritance hierarchy, so all we have to do is process all of - * the relids in the list that it returns. - */ - foreach(child, children) - { - Oid childrelid = lfirsti(child); - - if (childrelid == myrelid) - continue; - AlterTableAlterColumnFlags(childrelid, - false, colName, flagValue, flagType); - } - } - - /* -= now do the thing on this relation =- */ - - attrelation = heap_openr(AttributeRelationName, RowExclusiveLock); - - tuple = SearchSysCacheCopy(ATTNAME, - ObjectIdGetDatum(myrelid), - PointerGetDatum(colName), - 0, 0); - if (!HeapTupleIsValid(tuple)) - elog(ERROR, "ALTER TABLE: relation \"%s\" has no column \"%s\"", - RelationGetRelationName(rel), colName); - attrtuple = (Form_pg_attribute) GETSTRUCT(tuple); - - if (attrtuple->attnum < 0) - elog(ERROR, "ALTER TABLE: cannot change system attribute \"%s\"", - colName); - /* - * Now change the appropriate field - */ - if (*flagType == 'S') - attrtuple->attstattarget = newtarget; - else if (*flagType == 'M') - { - /* - * safety check: do not allow toasted storage modes unless column - * datatype is TOAST-aware. - */ - if (newstorage == 'p' || TypeIsToastable(attrtuple->atttypid)) - attrtuple->attstorage = newstorage; - else - elog(ERROR, "ALTER TABLE: Column datatype %s can only have storage \"plain\"", - format_type_be(attrtuple->atttypid)); - } - - simple_heap_update(attrelation, &tuple->t_self, tuple); - - /* keep system catalog indices current */ - { - Relation irelations[Num_pg_attr_indices]; - - CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, irelations); - CatalogIndexInsert(irelations, Num_pg_attr_indices, attrelation, tuple); - CatalogCloseIndices(Num_pg_attr_indices, irelations); - } - - heap_freetuple(tuple); - heap_close(attrelation, NoLock); - heap_close(rel, NoLock); /* close rel, but keep lock! */ -} - - -/* - * ALTER TABLE DROP COLUMN - */ -void -AlterTableDropColumn(Oid myrelid, - bool inh, const char *colName, - int behavior) -{ - elog(ERROR, "ALTER TABLE / DROP COLUMN is not implemented"); -} - - -/* - * ALTER TABLE ADD CONSTRAINT - */ -void -AlterTableAddConstraint(Oid myrelid, - bool inh, List *newConstraints) -{ - Relation rel; - List *listptr; - - /* - * Grab an exclusive lock on the target table, which we will NOT - * release until end of transaction. - */ - rel = heap_open(myrelid, AccessExclusiveLock); - - if (rel->rd_rel->relkind != RELKIND_RELATION) - elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table", - RelationGetRelationName(rel)); - - if (!allowSystemTableMods - && IsSystemRelation(rel)) - elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", - RelationGetRelationName(rel)); - - if (!pg_class_ownercheck(myrelid, GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(rel)); - - if (inh) - { - List *child, - *children; - - /* this routine is actually in the planner */ - children = find_all_inheritors(myrelid); - - /* - * find_all_inheritors does the recursive search of the - * inheritance hierarchy, so all we have to do is process all of - * the relids in the list that it returns. - */ - foreach(child, children) - { - Oid childrelid = lfirsti(child); - - if (childrelid == myrelid) - continue; - AlterTableAddConstraint(childrelid, false, newConstraints); - } - } - - foreach(listptr, newConstraints) - { - Node *newConstraint = lfirst(listptr); - - switch (nodeTag(newConstraint)) - { - case T_Constraint: - { - Constraint *constr = (Constraint *) newConstraint; - - /* - * Currently, we only expect to see CONSTR_CHECK nodes - * arriving here (see the preprocessing done in - * parser/analyze.c). Use a switch anyway to make it - * easier to add more code later. - */ - switch (constr->contype) - { - case CONSTR_CHECK: - { - ParseState *pstate; - bool successful = true; - HeapScanDesc scan; - ExprContext *econtext; - TupleTableSlot *slot; - HeapTuple tuple; - RangeTblEntry *rte; - List *qual; - Node *expr; - char *name; - - if (constr->name) - name = constr->name; - else - name = ""; - - /* - * We need to make a parse state and range - * table to allow us to transformExpr and - * fix_opids to get a version of the - * expression we can pass to ExecQual - */ - pstate = make_parsestate(NULL); - rte = addRangeTableEntryForRelation(pstate, - myrelid, - makeAlias(RelationGetRelationName(rel), NIL), - false, - true); - addRTEtoQuery(pstate, rte, true, true); - - /* - * Convert the A_EXPR in raw_expr into an - * EXPR - */ - expr = transformExpr(pstate, constr->raw_expr); - - /* - * Make sure it yields a boolean result. - */ - expr = coerce_to_boolean(expr, "CHECK"); - - /* - * Make sure no outside relations are - * referred to. - */ - if (length(pstate->p_rtable) != 1) - elog(ERROR, "Only relation '%s' can be referenced in CHECK", - RelationGetRelationName(rel)); - - /* - * No subplans or aggregates, either... - */ - if (contain_subplans(expr)) - elog(ERROR, "cannot use subselect in CHECK constraint expression"); - if (contain_agg_clause(expr)) - elog(ERROR, "cannot use aggregate function in CHECK constraint expression"); - - /* - * Might as well try to reduce any - * constant expressions. - */ - expr = eval_const_expressions(expr); - - /* And fix the opids */ - fix_opids(expr); - - qual = makeList1(expr); - - /* Make tuple slot to hold tuples */ - slot = MakeTupleTableSlot(); - ExecSetSlotDescriptor(slot, RelationGetDescr(rel), false); - /* Make an expression context for ExecQual */ - econtext = MakeExprContext(slot, CurrentMemoryContext); - - /* - * Scan through the rows now, checking the - * expression at each row. - */ - scan = heap_beginscan(rel, SnapshotNow, 0, NULL); - - while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) - { - ExecStoreTuple(tuple, slot, InvalidBuffer, false); - if (!ExecQual(qual, econtext, true)) - { - successful = false; - break; - } - ResetExprContext(econtext); - } - - heap_endscan(scan); - - FreeExprContext(econtext); - pfree(slot); - - if (!successful) - elog(ERROR, "AlterTableAddConstraint: rejected due to CHECK constraint %s", name); - - /* - * Call AddRelationRawConstraints to do - * the real adding -- It duplicates some - * of the above, but does not check the - * validity of the constraint against - * tuples already in the table. - */ - AddRelationRawConstraints(rel, NIL, - makeList1(constr)); - - break; - } - default: - elog(ERROR, "ALTER TABLE / ADD CONSTRAINT is not implemented for that constraint type."); - } - break; - } - case T_FkConstraint: - { - FkConstraint *fkconstraint = (FkConstraint *) newConstraint; - Relation pkrel; - HeapScanDesc scan; - HeapTuple tuple; - Trigger trig; - List *list; - int count; - - /* - * Grab an exclusive lock on the pk table, so that - * someone doesn't delete rows out from under us. - * - * XXX wouldn't a lesser lock be sufficient? - */ - pkrel = heap_openrv(fkconstraint->pktable, - AccessExclusiveLock); - - /* - * Validity checks - */ - if (pkrel->rd_rel->relkind != RELKIND_RELATION) - elog(ERROR, "referenced table \"%s\" not a relation", - fkconstraint->pktable->relname); - - if (isTempNamespace(RelationGetNamespace(pkrel)) && - !isTempNamespace(RelationGetNamespace(rel))) - elog(ERROR, "ALTER TABLE / ADD CONSTRAINT: Unable to reference temporary table from permanent table constraint."); - - /* - * First we check for limited correctness of the - * constraint. - * - * NOTE: we assume parser has already checked for - * existence of an appropriate unique index on the - * referenced relation, and that the column datatypes - * are comparable. - * - * Scan through each tuple, calling RI_FKey_check_ins - * (insert trigger) as if that tuple had just been - * inserted. If any of those fail, it should - * elog(ERROR) and that's that. - */ - MemSet(&trig, 0, sizeof(trig)); - trig.tgoid = InvalidOid; - if (fkconstraint->constr_name) - trig.tgname = fkconstraint->constr_name; - else - trig.tgname = ""; - trig.tgenabled = TRUE; - trig.tgisconstraint = TRUE; - trig.tgconstrrelid = RelationGetRelid(pkrel); - trig.tgdeferrable = FALSE; - trig.tginitdeferred = FALSE; - - trig.tgargs = (char **) palloc( - sizeof(char *) * (4 + length(fkconstraint->fk_attrs) - + length(fkconstraint->pk_attrs))); - - trig.tgargs[0] = trig.tgname; - trig.tgargs[1] = RelationGetRelationName(rel); - trig.tgargs[2] = RelationGetRelationName(pkrel); - trig.tgargs[3] = fkconstraint->match_type; - count = 4; - foreach(list, fkconstraint->fk_attrs) - { - Ident *fk_at = lfirst(list); - - trig.tgargs[count] = fk_at->name; - count += 2; - } - count = 5; - foreach(list, fkconstraint->pk_attrs) - { - Ident *pk_at = lfirst(list); - - trig.tgargs[count] = pk_at->name; - count += 2; - } - trig.tgnargs = count - 1; - - scan = heap_beginscan(rel, SnapshotNow, 0, NULL); - - while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) - { - /* Make a call to the check function */ - - /* - * No parameters are passed, but we do set a - * context - */ - FunctionCallInfoData fcinfo; - TriggerData trigdata; - - MemSet(&fcinfo, 0, sizeof(fcinfo)); - - /* - * We assume RI_FKey_check_ins won't look at - * flinfo... - */ - - trigdata.type = T_TriggerData; - trigdata.tg_event = TRIGGER_EVENT_INSERT | TRIGGER_EVENT_ROW; - trigdata.tg_relation = rel; - trigdata.tg_trigtuple = tuple; - trigdata.tg_newtuple = NULL; - trigdata.tg_trigger = &trig; - - fcinfo.context = (Node *) &trigdata; - - RI_FKey_check_ins(&fcinfo); - } - heap_endscan(scan); - - pfree(trig.tgargs); - - heap_close(pkrel, NoLock); - - break; - } - default: - elog(ERROR, "ALTER TABLE / ADD CONSTRAINT unable to determine type of constraint passed"); - } - } - - /* Close rel, but keep lock till commit */ - heap_close(rel, NoLock); -} - - -/* - * ALTER TABLE DROP CONSTRAINT - * Note: It is legal to remove a constraint with name "" as it is possible - * to add a constraint with name "". - * Christopher Kings-Lynne - */ -void -AlterTableDropConstraint(Oid myrelid, - bool inh, const char *constrName, - int behavior) -{ - Relation rel; - int deleted; - - /* - * We don't support CASCADE yet - in fact, RESTRICT doesn't work to - * the spec either! - */ - if (behavior == CASCADE) - elog(ERROR, "ALTER TABLE / DROP CONSTRAINT does not support the CASCADE keyword"); - - /* - * Acquire an exclusive lock on the target relation for the duration - * of the operation. - */ - rel = heap_open(myrelid, AccessExclusiveLock); - - /* Disallow DROP CONSTRAINT on views, indexes, sequences, etc */ - if (rel->rd_rel->relkind != RELKIND_RELATION) - elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table", - RelationGetRelationName(rel)); - - if (!allowSystemTableMods - && IsSystemRelation(rel)) - elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", - RelationGetRelationName(rel)); - - if (!pg_class_ownercheck(myrelid, GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(rel)); - - /* - * Since all we have is the name of the constraint, we have to look - * through all catalogs that could possibly contain a constraint for - * this relation. We also keep a count of the number of constraints - * removed. - */ - - deleted = 0; - - /* - * First, we remove all CHECK constraints with the given name - */ - - deleted += RemoveCheckConstraint(rel, constrName, inh); - - /* - * Now we remove NULL, UNIQUE, PRIMARY KEY and FOREIGN KEY - * constraints. - * - * Unimplemented. - */ - - /* Close the target relation */ - heap_close(rel, NoLock); - - /* If zero constraints deleted, complain */ - if (deleted == 0) - elog(ERROR, "ALTER TABLE / DROP CONSTRAINT: %s does not exist", - constrName); - /* Otherwise if more than one constraint deleted, notify */ - else if (deleted > 1) - elog(NOTICE, "Multiple constraints dropped"); -} - -/* - * ALTER TABLE OWNER - */ -void -AlterTableOwner(Oid relationOid, int32 newOwnerSysId) -{ - Relation target_rel; - Relation class_rel; - HeapTuple tuple; - Relation idescs[Num_pg_class_indices]; - Form_pg_class tuple_class; - - /* Get exclusive lock till end of transaction on the target table */ - /* Use relation_open here so that we work on indexes... */ - target_rel = relation_open(relationOid, AccessExclusiveLock); - - /* Get its pg_class tuple, too */ - class_rel = heap_openr(RelationRelationName, RowExclusiveLock); - - tuple = SearchSysCacheCopy(RELOID, - ObjectIdGetDatum(relationOid), - 0, 0, 0); - if (!HeapTupleIsValid(tuple)) - elog(ERROR, "ALTER TABLE: relation %u not found", relationOid); - tuple_class = (Form_pg_class) GETSTRUCT(tuple); - - /* Can we change the ownership of this tuple? */ - CheckTupleType(tuple_class); - - /* - * Okay, this is a valid tuple: change its ownership and - * write to the heap. - */ - tuple_class->relowner = newOwnerSysId; - simple_heap_update(class_rel, &tuple->t_self, tuple); - - /* Keep the catalog indices up to date */ - CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, idescs); - CatalogIndexInsert(idescs, Num_pg_class_indices, class_rel, tuple); - CatalogCloseIndices(Num_pg_class_indices, idescs); - - /* - * If we are operating on a table, also change the ownership of any - * indexes that belong to the table, as well as the table's toast - * table (if it has one) - */ - if (tuple_class->relkind == RELKIND_RELATION || - tuple_class->relkind == RELKIND_TOASTVALUE) - { - List *index_oid_list, *i; - - /* Find all the indexes belonging to this relation */ - index_oid_list = RelationGetIndexList(target_rel); - - /* For each index, recursively change its ownership */ - foreach(i, index_oid_list) - { - AlterTableOwner(lfirsti(i), newOwnerSysId); - } - - freeList(index_oid_list); - } - - if (tuple_class->relkind == RELKIND_RELATION) - { - /* If it has a toast table, recurse to change its ownership */ - if (tuple_class->reltoastrelid != InvalidOid) - { - AlterTableOwner(tuple_class->reltoastrelid, newOwnerSysId); - } - } - - heap_freetuple(tuple); - heap_close(class_rel, RowExclusiveLock); - relation_close(target_rel, NoLock); -} - -static void -CheckTupleType(Form_pg_class tuple_class) -{ - switch (tuple_class->relkind) - { - case RELKIND_RELATION: - case RELKIND_INDEX: - case RELKIND_VIEW: - case RELKIND_SEQUENCE: - case RELKIND_TOASTVALUE: - /* ok to change owner */ - break; - default: - elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table, TOAST table, index, view, or sequence", - NameStr(tuple_class->relname)); - } -} - -/* - * ALTER TABLE CREATE TOAST TABLE - */ -void -AlterTableCreateToastTable(Oid relOid, bool silent) -{ - Relation rel; - HeapTuple reltup; - HeapTupleData classtuple; - TupleDesc tupdesc; - bool shared_relation; - Relation class_rel; - Buffer buffer; - Relation ridescs[Num_pg_class_indices]; - Oid toast_relid; - Oid toast_idxid; - char toast_relname[NAMEDATALEN]; - char toast_idxname[NAMEDATALEN]; - IndexInfo *indexInfo; - Oid classObjectId[2]; - - /* - * Grab an exclusive lock on the target table, which we will NOT - * release until end of transaction. - */ - rel = heap_open(relOid, AccessExclusiveLock); - - /* Check permissions */ - if (rel->rd_rel->relkind != RELKIND_RELATION) - elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table", - RelationGetRelationName(rel)); - - if (!pg_class_ownercheck(relOid, GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(rel)); - - /* - * Toast table is shared if and only if its parent is. - * - * We cannot allow toasting a shared relation after initdb (because - * there's no way to mark it toasted in other databases' pg_class). - * Unfortunately we can't distinguish initdb from a manually started - * standalone backend. However, we can at least prevent this mistake - * under normal multi-user operation. - */ - shared_relation = rel->rd_rel->relisshared; - if (shared_relation && IsUnderPostmaster) - elog(ERROR, "Shared relations cannot be toasted after initdb"); - - /* - * lock the pg_class tuple for update (is that really needed?) - */ - class_rel = heap_openr(RelationRelationName, RowExclusiveLock); - - reltup = SearchSysCache(RELOID, - ObjectIdGetDatum(relOid), - 0, 0, 0); - if (!HeapTupleIsValid(reltup)) - elog(ERROR, "ALTER TABLE: relation \"%s\" not found", - RelationGetRelationName(rel)); - classtuple.t_self = reltup->t_self; - ReleaseSysCache(reltup); - - switch (heap_mark4update(class_rel, &classtuple, &buffer, - GetCurrentCommandId())) - { - case HeapTupleSelfUpdated: - case HeapTupleMayBeUpdated: - break; - default: - elog(ERROR, "couldn't lock pg_class tuple"); - } - reltup = heap_copytuple(&classtuple); - ReleaseBuffer(buffer); - - /* - * Is it already toasted? - */ - if (((Form_pg_class) GETSTRUCT(reltup))->reltoastrelid != InvalidOid) - { - if (silent) - { - heap_close(rel, NoLock); - heap_close(class_rel, NoLock); - heap_freetuple(reltup); - return; - } - - elog(ERROR, "ALTER TABLE: relation \"%s\" already has a toast table", - RelationGetRelationName(rel)); - } - - /* - * Check to see whether the table actually needs a TOAST table. - */ - if (!needs_toast_table(rel)) - { - if (silent) - { - heap_close(rel, NoLock); - heap_close(class_rel, NoLock); - heap_freetuple(reltup); - return; - } - - elog(ERROR, "ALTER TABLE: relation \"%s\" does not need a toast table", - RelationGetRelationName(rel)); - } - - /* - * Create the toast table and its index - */ - sprintf(toast_relname, "pg_toast_%u", relOid); - sprintf(toast_idxname, "pg_toast_%u_index", relOid); - - /* this is pretty painful... need a tuple descriptor */ - tupdesc = CreateTemplateTupleDesc(3); - TupleDescInitEntry(tupdesc, (AttrNumber) 1, - "chunk_id", - OIDOID, - -1, 0, false); - TupleDescInitEntry(tupdesc, (AttrNumber) 2, - "chunk_seq", - INT4OID, - -1, 0, false); - TupleDescInitEntry(tupdesc, (AttrNumber) 3, - "chunk_data", - BYTEAOID, - -1, 0, false); - - /* - * Ensure that the toast table doesn't itself get toasted, or we'll be - * toast :-(. This is essential for chunk_data because type bytea is - * toastable; hit the other two just to be sure. - */ - tupdesc->attrs[0]->attstorage = 'p'; - tupdesc->attrs[1]->attstorage = 'p'; - tupdesc->attrs[2]->attstorage = 'p'; - - /* - * Note: the toast relation is placed in the regular pg_toast namespace - * even if its master relation is a temp table. There cannot be any - * naming collision, and the toast rel will be destroyed when its master - * is, so there's no need to handle the toast rel as temp. - */ - toast_relid = heap_create_with_catalog(toast_relname, - PG_TOAST_NAMESPACE, - tupdesc, - RELKIND_TOASTVALUE, - shared_relation, - false, - true); - - /* make the toast relation visible, else index creation will fail */ - CommandCounterIncrement(); - - /* - * Create unique index on chunk_id, chunk_seq. - * - * NOTE: the tuple toaster could actually function with a single-column - * index on chunk_id only. However, it couldn't be unique then. We - * want it to be unique as a check against the possibility of - * duplicate TOAST chunk OIDs. Too, the index might be a little more - * efficient this way, since btree isn't all that happy with large - * numbers of equal keys. - */ - - indexInfo = makeNode(IndexInfo); - indexInfo->ii_NumIndexAttrs = 2; - indexInfo->ii_NumKeyAttrs = 2; - indexInfo->ii_KeyAttrNumbers[0] = 1; - indexInfo->ii_KeyAttrNumbers[1] = 2; - indexInfo->ii_Predicate = NIL; - indexInfo->ii_FuncOid = InvalidOid; - indexInfo->ii_Unique = true; - - classObjectId[0] = OID_BTREE_OPS_OID; - classObjectId[1] = INT4_BTREE_OPS_OID; - - toast_idxid = index_create(toast_relid, toast_idxname, indexInfo, - BTREE_AM_OID, classObjectId, - true, true); - - /* - * Update toast rel's pg_class entry to show that it has an index. The - * index OID is stored into the reltoastidxid field for easy access by - * the tuple toaster. - */ - setRelhasindex(toast_relid, true, true, toast_idxid); - - /* - * Store the toast table's OID in the parent relation's tuple - */ - ((Form_pg_class) GETSTRUCT(reltup))->reltoastrelid = toast_relid; - simple_heap_update(class_rel, &reltup->t_self, reltup); - - /* - * Keep catalog indices current - */ - CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs); - CatalogIndexInsert(ridescs, Num_pg_class_indices, class_rel, reltup); - CatalogCloseIndices(Num_pg_class_indices, ridescs); - - heap_freetuple(reltup); - - /* - * Close relations and make changes visible - */ - heap_close(class_rel, NoLock); - heap_close(rel, NoLock); - - CommandCounterIncrement(); -} - -/* - * Check to see whether the table needs a TOAST table. It does only if - * (1) there are any toastable attributes, and (2) the maximum length - * of a tuple could exceed TOAST_TUPLE_THRESHOLD. (We don't want to - * create a toast table for something like "f1 varchar(20)".) - */ -static bool -needs_toast_table(Relation rel) -{ - int32 data_length = 0; - bool maxlength_unknown = false; - bool has_toastable_attrs = false; - TupleDesc tupdesc; - Form_pg_attribute *att; - int32 tuple_length; - int i; - - tupdesc = rel->rd_att; - att = tupdesc->attrs; - - for (i = 0; i < tupdesc->natts; i++) - { - data_length = att_align(data_length, att[i]->attlen, att[i]->attalign); - if (att[i]->attlen >= 0) - { - /* Fixed-length types are never toastable */ - data_length += att[i]->attlen; - } - else - { - int32 maxlen = type_maximum_size(att[i]->atttypid, - att[i]->atttypmod); - - if (maxlen < 0) - maxlength_unknown = true; - else - data_length += maxlen; - if (att[i]->attstorage != 'p') - has_toastable_attrs = true; - } - } - if (!has_toastable_attrs) - return false; /* nothing to toast? */ - if (maxlength_unknown) - return true; /* any unlimited-length attrs? */ - tuple_length = MAXALIGN(offsetof(HeapTupleHeaderData, t_bits) + - BITMAPLEN(tupdesc->natts)) + - MAXALIGN(data_length); - return (tuple_length > TOAST_TUPLE_THRESHOLD); -} -- cgit v1.2.3