Peter Eisentraut wrote: > On 11/26/14 9:27 AM, Alvaro Herrera wrote: > > I haven't done anything about documentation. I thought a new chapter > > after "Additional Supplied Modules", perhaps entitled "Additional Sample > > Modules" would be appropriate. > > I would remove the SGML files and put simple README files into each > directory.
They are so small that it makes sense to do it like that. Here's a patch for this. I have also changed things so that: 1. test modules are not installed by "make install", not checked by "make installcheck", not checked by "make check". 2. test modules are checked by "make check-world" (this is consistent with handling of contrib). 3. test modules are checked by "make installcheck-world" (this is consistent with handling of contrib) 4. test modules are installed by "make install-world". This is consistent with contrib, and it's necessary so that "make installcheck-world" passes. I moved the contents from SGML files into READMEs, and removed the references from other SGML files, turning them into <filename>contrib/</> instead (these are release-9.4 and so on, which is why I reference the old locations. I assume release-9.5 will mention the moves). There's some untested new code in vcregress.pl, but nothing else about msvc has been done. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
diff --git a/GNUmakefile.in b/GNUmakefile.in index 69e0824..8dbbcee 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -32,7 +32,7 @@ install: install-docs: $(MAKE) -C doc install -$(call recurse,install-world,doc src config contrib,install) +$(call recurse,install-world,doc src config contrib src/test/modules,install) install-world: +@echo "PostgreSQL, contrib, and documentation installation complete." diff --git a/contrib/Makefile b/contrib/Makefile index b37d0dd..efee109 100644 --- a/contrib/Makefile +++ b/contrib/Makefile @@ -16,7 +16,6 @@ SUBDIRS = \ dblink \ dict_int \ dict_xsyn \ - dummy_seclabel \ earthdistance \ file_fdw \ fuzzystrmatch \ @@ -50,13 +49,9 @@ SUBDIRS = \ spi \ tablefunc \ tcn \ - test_decoding \ - test_parser \ - test_shm_mq \ tsearch2 \ unaccent \ - vacuumlo \ - worker_spi + vacuumlo ifeq ($(with_openssl),yes) SUBDIRS += sslinfo diff --git a/contrib/pg_upgrade/test.sh b/contrib/pg_upgrade/test.sh index 7bbd2c7..41614b2 100644 --- a/contrib/pg_upgrade/test.sh +++ b/contrib/pg_upgrade/test.sh @@ -65,6 +65,7 @@ if [ "$1" = '--install' ]; then "$MAKE" -s -C ../.. install DESTDIR="$temp_install" "$MAKE" -s -C ../pg_upgrade_support install DESTDIR="$temp_install" "$MAKE" -s -C . install DESTDIR="$temp_install" + "$MAKE" -s -C ../../src/test/modules install DESTDIR="$temp_install" # platform-specific magic to find the shared libraries; see pg_regress.c LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH @@ -143,7 +144,14 @@ set -x "$oldbindir"/initdb -N "$oldbindir"/pg_ctl start -l "$logdir/postmaster1.log" -o "$POSTMASTER_OPTS" -w -if "$MAKE" -C "$oldsrc" installcheck; then +"$MAKE" -C "$oldsrc" installcheck +make_installcheck_status=$? +if [ $make_installcheck_status -eq 0 ]; then + "$MAKE" -C "$oldsrc"/src/test/modules installcheck + make_installcheck_status=$? +fi + +if [ $make_installcheck_status -eq 0 ]; then pg_dumpall -f "$temp_root"/dump1.sql || pg_dumpall1_status=$? if [ "$newsrc" != "$oldsrc" ]; then oldpgversion=`psql -A -t -d regression -c "SHOW server_version_num"` @@ -165,12 +173,9 @@ if "$MAKE" -C "$oldsrc" installcheck; then sed "s;$oldsrc;$newsrc;g" "$temp_root"/dump1.sql.orig >"$temp_root"/dump1.sql fi else - make_installcheck_status=$? -fi -"$oldbindir"/pg_ctl -m fast stop -if [ -n "$make_installcheck_status" ]; then exit 1 fi +"$oldbindir"/pg_ctl -m fast stop if [ -n "$psql_fix_sql_status" ]; then exit 1 fi diff --git a/doc/src/sgml/contrib.sgml b/doc/src/sgml/contrib.sgml index ec68f10..8836b0c 100644 --- a/doc/src/sgml/contrib.sgml +++ b/doc/src/sgml/contrib.sgml @@ -113,7 +113,6 @@ CREATE EXTENSION <replaceable>module_name</> FROM unpackaged; &dblink; &dict-int; &dict-xsyn; - &dummy-seclabel; &earthdistance; &file-fdw; &fuzzystrmatch; @@ -140,9 +139,6 @@ CREATE EXTENSION <replaceable>module_name</> FROM unpackaged; &sslinfo; &tablefunc; &tcn; - &test-decoding; - &test-parser; - &test-shm-mq; &tsearch2; &unaccent; &uuid-ossp; diff --git a/doc/src/sgml/dummy-seclabel.sgml b/doc/src/sgml/dummy-seclabel.sgml deleted file mode 100644 index d064705..0000000 --- a/doc/src/sgml/dummy-seclabel.sgml +++ /dev/null @@ -1,74 +0,0 @@ -<!-- doc/src/sgml/dummy-seclabel.sgml --> - -<sect1 id="dummy-seclabel" xreflabel="dummy_seclabel"> - <title>dummy_seclabel</title> - - <indexterm zone="dummy-seclabel"> - <primary>dummy_seclabel</primary> - </indexterm> - - <para> - The <filename>dummy_seclabel</> module exists only to support regression - testing of the <command>SECURITY LABEL</> statement. It is not intended - to be used in production. - </para> - - <sect2> - <title>Rationale</title> - - <para> - The <command>SECURITY LABEL</> statement allows the user to assign security - labels to database objects; however, security labels can only be assigned - when specifically allowed by a loadable module, so this module is provided - to allow proper regression testing. - </para> - - <para> - Security label providers intended to be used in production will typically be - dependent on a platform-specific feature such as - <productname>SE-Linux</productname>. This module is platform-independent, - and therefore better-suited to regression testing. - </para> - </sect2> - - <sect2> - <title>Usage</title> - - <para> - Here's a simple example of usage: - </para> - -<programlisting> -# postgresql.conf -shared_preload_libraries = 'dummy_seclabel' -</programlisting> - -<programlisting> -postgres=# CREATE TABLE t (a int, b text); -CREATE TABLE -postgres=# SECURITY LABEL ON TABLE t IS 'classified'; -SECURITY LABEL -</programlisting> - - <para> - The <filename>dummy_seclabel</> module provides only four hardcoded - labels: <literal>unclassified</>, <literal>classified</>, - <literal>secret</>, and <literal>top secret</>. - It does not allow any other strings as security labels. - </para> - <para> - These labels are not used to enforce access controls. They are only used - to check whether the <command>SECURITY LABEL</> statement works as expected, - or not. - </para> - </sect2> - - <sect2> - <title>Author</title> - - <para> - KaiGai Kohei <email>kai...@ak.jp.nec.com</email> - </para> - </sect2> - -</sect1> diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml index 3fcde9f..97150c1 100644 --- a/doc/src/sgml/logicaldecoding.sgml +++ b/doc/src/sgml/logicaldecoding.sgml @@ -337,9 +337,7 @@ $ pg_recvlogical -d postgres --slot test --drop-slot <title>Logical Decoding Output Plugins</title> <para> An example output plugin can be found in the - <link linkend="test-decoding"> - <filename>contrib/test_decoding</filename> - </link> + <filename>src/test/modules/test_decoding</filename> subdirectory of the PostgreSQL source tree. </para> <sect2 id="logicaldecoding-output-init"> diff --git a/doc/src/sgml/ref/security_label.sgml b/doc/src/sgml/ref/security_label.sgml index 6e2bd25..998fe3b 100644 --- a/doc/src/sgml/ref/security_label.sgml +++ b/doc/src/sgml/ref/security_label.sgml @@ -207,7 +207,7 @@ SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_ <title>See Also</title> <simplelist type="inline"> <member><xref linkend="sepgsql"></member> - <member><xref linkend="dummy-seclabel"></member> + <member><filename>src/test/modules/dummy_seclabel</filename></member> </simplelist> </refsect1> </refentry> diff --git a/doc/src/sgml/release-9.1.sgml b/doc/src/sgml/release-9.1.sgml index 4f86b64..79a8b07 100644 --- a/doc/src/sgml/release-9.1.sgml +++ b/doc/src/sgml/release-9.1.sgml @@ -8062,7 +8062,7 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10; <listitem> <para> - Add <link linkend="dummy-seclabel"><filename>dummy_seclabel</></link> + Add <filename>dummy_seclabel</> contrib module (KaiGai Kohei) </para> diff --git a/doc/src/sgml/release-9.4.sgml b/doc/src/sgml/release-9.4.sgml index a249b3f..adffde6 100644 --- a/doc/src/sgml/release-9.4.sgml +++ b/doc/src/sgml/release-9.4.sgml @@ -503,7 +503,7 @@ </para> <para> - This feature is illustrated in <xref linkend="test-shm-mq">. + This feature is illustrated in <filename>contrib/test_shm_mq</filename>. </para> </listitem> @@ -1126,7 +1126,7 @@ <listitem> <para> - Add <xref linkend="test-decoding"> module to illustrate logical + Add <filename>contrib/test_decoding</> module to illustrate logical decoding at the <acronym>SQL</> level (Andres Freund) </para> </listitem> diff --git a/doc/src/sgml/test-decoding.sgml b/doc/src/sgml/test-decoding.sgml deleted file mode 100644 index 23cdfe3..0000000 --- a/doc/src/sgml/test-decoding.sgml +++ /dev/null @@ -1,42 +0,0 @@ -<!-- doc/src/sgml/test-decoding.sgml --> - -<sect1 id="test-decoding" xreflabel="test_decoding"> - <title>test_decoding</title> - - <indexterm zone="test-decoding"> - <primary>test_decoding</primary> - </indexterm> - - <para> - <filename>test_decoding</> is an example of a logical decoding - output plugin. It doesn't do anything especially useful, but can serve as - a starting point for developing your own decoder. - </para> - - <para> - <filename>test_decoding</> receives WAL through the logical decoding - mechanism and decodes it into text representations of the operations - performed. - </para> - - <para> - Typical output from this plugin, used over the SQL logical decoding - interface, might be: - -<programlisting> -postgres=# SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'include-xids', '0'); - location | xid | data ------------+-----+-------------------------------------------------- - 0/16D30F8 | 691 | BEGIN - 0/16D32A0 | 691 | table public.data: INSERT: id[int4]:2 data[text]:'arg' - 0/16D32A0 | 691 | table public.data: INSERT: id[int4]:3 data[text]:'demo' - 0/16D32A0 | 691 | COMMIT - 0/16D32D8 | 692 | BEGIN - 0/16D3398 | 692 | table public.data: DELETE: id[int4]:2 - 0/16D3398 | 692 | table public.data: DELETE: id[int4]:3 - 0/16D3398 | 692 | COMMIT -(8 rows) -</programlisting> - </para> - -</sect1> diff --git a/doc/src/sgml/test-parser.sgml b/doc/src/sgml/test-parser.sgml deleted file mode 100644 index 28b1e91..0000000 --- a/doc/src/sgml/test-parser.sgml +++ /dev/null @@ -1,90 +0,0 @@ -<!-- doc/src/sgml/test-parser.sgml --> - -<sect1 id="test-parser" xreflabel="test_parser"> - <title>test_parser</title> - - <indexterm zone="test-parser"> - <primary>test_parser</primary> - </indexterm> - - <para> - <filename>test_parser</> is an example of a custom parser for full-text - search. It doesn't do anything especially useful, but can serve as - a starting point for developing your own parser. - </para> - - <para> - <filename>test_parser</> recognizes words separated by white space, - and returns just two token types: - -<programlisting> -mydb=# SELECT * FROM ts_token_type('testparser'); - tokid | alias | description --------+-------+--------------- - 3 | word | Word - 12 | blank | Space symbols -(2 rows) -</programlisting> - - These token numbers have been chosen to be compatible with the default - parser's numbering. This allows us to use its <function>headline()</> - function, thus keeping the example simple. - </para> - - <sect2> - <title>Usage</title> - - <para> - Installing the <literal>test_parser</> extension creates a text search - parser <literal>testparser</>. It has no user-configurable parameters. - </para> - - <para> - You can test the parser with, for example, - -<programlisting> -mydb=# SELECT * FROM ts_parse('testparser', 'That''s my first own parser'); - tokid | token --------+-------- - 3 | That's - 12 | - 3 | my - 12 | - 3 | first - 12 | - 3 | own - 12 | - 3 | parser -</programlisting> - </para> - - <para> - Real-world use requires setting up a text search configuration - that uses the parser. For example, - -<programlisting> -mydb=# CREATE TEXT SEARCH CONFIGURATION testcfg ( PARSER = testparser ); -CREATE TEXT SEARCH CONFIGURATION - -mydb=# ALTER TEXT SEARCH CONFIGURATION testcfg -mydb-# ADD MAPPING FOR word WITH english_stem; -ALTER TEXT SEARCH CONFIGURATION - -mydb=# SELECT to_tsvector('testcfg', 'That''s my first own parser'); - to_tsvector -------------------------------- - 'that':1 'first':3 'parser':5 -(1 row) - -mydb=# SELECT ts_headline('testcfg', 'Supernovae stars are the brightest phenomena in galaxies', -mydb(# to_tsquery('testcfg', 'star')); - ts_headline ------------------------------------------------------------------ - Supernovae <b>stars</b> are the brightest phenomena in galaxies -(1 row) -</programlisting> - </para> - - </sect2> - -</sect1> diff --git a/doc/src/sgml/test-shm-mq.sgml b/doc/src/sgml/test-shm-mq.sgml deleted file mode 100644 index dd431d0..0000000 --- a/doc/src/sgml/test-shm-mq.sgml +++ /dev/null @@ -1,71 +0,0 @@ -<!-- doc/src/sgml/test-shm-mq.sgml --> - -<sect1 id="test-shm-mq" xreflabel="test_shm_mq"> - <title>test_shm_mq</title> - - <indexterm zone="test-shm-mq"> - <primary>test_shm_mq</primary> - </indexterm> - - <para> - <filename>test_shm_mq</> is an example of how to use dynamic shared memory - and the shared memory message queue facilities to coordinate a user backend - with the efforts of one or more background workers. It is not intended to - do anything useful on its own; rather, it is a demonstration of how these - facilities can be used, and a unit test of those facilities. - </para> - - <para> - The function is this extension send the same message repeatedly through - a loop of processes. The message payload, the size of the message queue - through which it is sent, and the number of processes in the loop are - configurable. At the end, the message may be verified to ensure that it - has not been corrupted in transmission. - </para> - - <sect2> - <title>Functions</title> - -<synopsis> -test_shm_mq(queue_size int8, message text, - repeat_count int4 default 1, num_workers int4 default 1) - RETURNS void -</synopsis> - - <para> - This function sends and receives messages synchronously. The user - backend sends the provided message to the first background worker using - a message queue of the given size. The first background worker sends - the message to the second background worker, if the number of workers - is greater than one, and so forth. Eventually, the last background - worker sends the message back to the user backend. If the repeat count - is greater than one, the user backend then sends the message back to - the first worker. Once the message has been sent and received by all - the coordinating processes a number of times equal to the repeat count, - the user backend verifies that the message finally received matches the - one originally sent and throws an error if not. - </para> - -<synopsis> -test_shm_mq_pipelined(queue_size int8, message text, - repeat_count int4 default 1, num_workers int4 default 1, - verify bool default true) - RETURNS void -</synopsis> - - <para> - This function sends the same message multiple times, as specified by the - repeat count, to the first background worker using a queue of the given - size. These messages are then forwarded to each background worker in - turn, in each case using a queue of the given size. Finally, the last - background worker sends the messages back to the user backend. The user - backend uses non-blocking sends and receives, so that it may begin receiving - copies of the message before it has finished sending all copies of the - message. The <literal>verify</> argument controls whether or not the - received copies are checked against the message that was sent. (This - takes nontrivial time so it may be useful to disable it for benchmarking - purposes.) - </para> - - </sect2> -</sect1> diff --git a/src/test/Makefile b/src/test/Makefile index 0fd7eab..5d997b8 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -12,6 +12,6 @@ subdir = src/test top_builddir = ../.. include $(top_builddir)/src/Makefile.global -SUBDIRS = regress isolation +SUBDIRS = regress isolation modules $(recurse) diff --git a/src/test/modules/Makefile b/src/test/modules/Makefile new file mode 100644 index 0000000..8a6e3dd --- /dev/null +++ b/src/test/modules/Makefile @@ -0,0 +1,14 @@ +# src/test/modules/Makefile + +subdir = src/test/modules +top_builddir = ../../.. +include $(top_builddir)/src/Makefile.global + +SUBDIRS = \ + worker_spi \ + test_decoding \ + dummy_seclabel \ + test_shm_mq \ + test_parser + +$(recurse) diff --git a/contrib/dummy_seclabel/Makefile b/src/test/modules/dummy_seclabel/Makefile similarity index 73% rename from contrib/dummy_seclabel/Makefile rename to src/test/modules/dummy_seclabel/Makefile index e69aa1f..909ac9a 100644 --- a/contrib/dummy_seclabel/Makefile +++ b/src/test/modules/dummy_seclabel/Makefile @@ -1,4 +1,4 @@ -# contrib/dummy_seclabel/Makefile +# src/test/modules/dummy_seclabel/Makefile MODULES = dummy_seclabel PGFILEDESC = "dummy_seclabel - regression testing of the SECURITY LABEL statement" @@ -8,8 +8,8 @@ PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else -subdir = contrib/dummy_seclabel -top_builddir = ../.. +subdir = src/test/modules/dummy_seclabel +top_builddir = ../../../.. include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif diff --git a/src/test/modules/dummy_seclabel/README b/src/test/modules/dummy_seclabel/README new file mode 100644 index 0000000..75320aa --- /dev/null +++ b/src/test/modules/dummy_seclabel/README @@ -0,0 +1,43 @@ +The dummy_seclabel module exists only to support regression +testing of the SECURITY LABEL statement. It is not intended +to be used in production. + +Rationale +========= + +The SECURITY LABEL statement allows the user to assign security +labels to database objects; however, security labels can only be assigned +when specifically allowed by a loadable module, so this module is provided +to allow proper regression testing. + +Security label providers intended to be used in production will typically be +dependent on a platform-specific feature such as +SE-Linux. This module is platform-independent, +and therefore better-suited to regression testing. + +Usage +===== + +Here's a simple example of usage: + +# postgresql.conf +shared_preload_libraries = 'dummy_seclabel' + +postgres=# CREATE TABLE t (a int, b text); +CREATE TABLE +postgres=# SECURITY LABEL ON TABLE t IS 'classified'; +SECURITY LABEL + +The dummy_seclabel module provides only four hardcoded +labels: unclassified, classified, +secret, and top secret. +It does not allow any other strings as security labels. + +These labels are not used to enforce access controls. They are only used +to check whether the SECURITY LABEL statement works as expected, +or not. + +Author +====== + +KaiGai Kohei <kai...@ak.jp.nec.com> diff --git a/contrib/dummy_seclabel/dummy_seclabel.c b/src/test/modules/dummy_seclabel/dummy_seclabel.c similarity index 100% rename from contrib/dummy_seclabel/dummy_seclabel.c rename to src/test/modules/dummy_seclabel/dummy_seclabel.c diff --git a/contrib/test_decoding/.gitignore b/src/test/modules/test_decoding/.gitignore similarity index 100% rename from contrib/test_decoding/.gitignore rename to src/test/modules/test_decoding/.gitignore diff --git a/contrib/test_decoding/Makefile b/src/test/modules/test_decoding/Makefile similarity index 78% rename from contrib/test_decoding/Makefile rename to src/test/modules/test_decoding/Makefile index 438be44..b9b8599 100644 --- a/contrib/test_decoding/Makefile +++ b/src/test/modules/test_decoding/Makefile @@ -1,4 +1,4 @@ -# contrib/test_decoding/Makefile +# src/test/modules/test_decoding/Makefile MODULES = test_decoding PGFILEDESC = "test_decoding - example of a logical decoding output plugin" @@ -12,8 +12,8 @@ PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else -subdir = contrib/test_decoding -top_builddir = ../.. +subdir = src/test/modules/test_decoding +top_builddir = ../../../.. include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif @@ -35,22 +35,22 @@ submake-isolation: $(MAKE) -C $(top_builddir)/src/test/isolation all submake-test_decoding: - $(MAKE) -C $(top_builddir)/contrib/test_decoding + $(MAKE) -C $(top_builddir)/src/test/modules/test_decoding REGRESSCHECKS=ddl rewrite toast permissions decoding_in_xact decoding_into_rel binary prepared regresscheck: all | submake-regress submake-test_decoding $(MKDIR_P) regression_output $(pg_regress_check) \ - --temp-config $(top_srcdir)/contrib/test_decoding/logical.conf \ + --temp-config $(top_srcdir)/src/test/modules/test_decoding/logical.conf \ --temp-install=./tmp_check \ - --extra-install=contrib/test_decoding \ + --extra-install=src/test/modules/test_decoding \ --outputdir=./regression_output \ $(REGRESSCHECKS) regresscheck-install-force: | submake-regress submake-test_decoding $(pg_regress_installcheck) \ - --extra-install=contrib/test_decoding \ + --extra-install=src/test/modules/test_decoding \ $(REGRESSCHECKS) ISOLATIONCHECKS=mxact delayed_startup ondisk_startup concurrent_ddl_dml @@ -58,14 +58,14 @@ ISOLATIONCHECKS=mxact delayed_startup ondisk_startup concurrent_ddl_dml isolationcheck: all | submake-isolation submake-test_decoding $(MKDIR_P) isolation_output $(pg_isolation_regress_check) \ - --temp-config $(top_srcdir)/contrib/test_decoding/logical.conf \ - --extra-install=contrib/test_decoding \ + --temp-config $(top_srcdir)/src/test/modules/test_decoding/logical.conf \ + --extra-install=src/test/modules/test_decoding \ --outputdir=./isolation_output \ $(ISOLATIONCHECKS) isolationcheck-install-force: all | submake-isolation submake-test_decoding $(pg_isolation_regress_installcheck) \ - --extra-install=contrib/test_decoding \ + --extra-install=src/test/modules/test_decoding \ $(ISOLATIONCHECKS) PHONY: submake-test_decoding submake-regress check \ diff --git a/src/test/modules/test_decoding/README b/src/test/modules/test_decoding/README new file mode 100644 index 0000000..254e750 --- /dev/null +++ b/src/test/modules/test_decoding/README @@ -0,0 +1,23 @@ +test_decoding is an example of a logical decoding +output plugin. It doesn't do anything especially useful, but can serve as +a starting point for developing your own decoder. + +test_decoding receives WAL through the logical decoding +mechanism and decodes it into text representations of the operations +performed. + +Typical output from this plugin, used over the SQL logical decoding +interface, might be: + +postgres=# SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'include-xids', '0'); + location | xid | data +-----------+-----+-------------------------------------------------- + 0/16D30F8 | 691 | BEGIN + 0/16D32A0 | 691 | table public.data: INSERT: id[int4]:2 data[text]:'arg' + 0/16D32A0 | 691 | table public.data: INSERT: id[int4]:3 data[text]:'demo' + 0/16D32A0 | 691 | COMMIT + 0/16D32D8 | 692 | BEGIN + 0/16D3398 | 692 | table public.data: DELETE: id[int4]:2 + 0/16D3398 | 692 | table public.data: DELETE: id[int4]:3 + 0/16D3398 | 692 | COMMIT +(8 rows) diff --git a/contrib/test_decoding/expected/binary.out b/src/test/modules/test_decoding/expected/binary.out similarity index 100% rename from contrib/test_decoding/expected/binary.out rename to src/test/modules/test_decoding/expected/binary.out diff --git a/contrib/test_decoding/expected/concurrent_ddl_dml.out b/src/test/modules/test_decoding/expected/concurrent_ddl_dml.out similarity index 100% rename from contrib/test_decoding/expected/concurrent_ddl_dml.out rename to src/test/modules/test_decoding/expected/concurrent_ddl_dml.out diff --git a/contrib/test_decoding/expected/ddl.out b/src/test/modules/test_decoding/expected/ddl.out similarity index 100% rename from contrib/test_decoding/expected/ddl.out rename to src/test/modules/test_decoding/expected/ddl.out diff --git a/contrib/test_decoding/expected/decoding_in_xact.out b/src/test/modules/test_decoding/expected/decoding_in_xact.out similarity index 100% rename from contrib/test_decoding/expected/decoding_in_xact.out rename to src/test/modules/test_decoding/expected/decoding_in_xact.out diff --git a/contrib/test_decoding/expected/decoding_into_rel.out b/src/test/modules/test_decoding/expected/decoding_into_rel.out similarity index 100% rename from contrib/test_decoding/expected/decoding_into_rel.out rename to src/test/modules/test_decoding/expected/decoding_into_rel.out diff --git a/contrib/test_decoding/expected/delayed_startup.out b/src/test/modules/test_decoding/expected/delayed_startup.out similarity index 100% rename from contrib/test_decoding/expected/delayed_startup.out rename to src/test/modules/test_decoding/expected/delayed_startup.out diff --git a/contrib/test_decoding/expected/mxact.out b/src/test/modules/test_decoding/expected/mxact.out similarity index 100% rename from contrib/test_decoding/expected/mxact.out rename to src/test/modules/test_decoding/expected/mxact.out diff --git a/contrib/test_decoding/expected/ondisk_startup.out b/src/test/modules/test_decoding/expected/ondisk_startup.out similarity index 100% rename from contrib/test_decoding/expected/ondisk_startup.out rename to src/test/modules/test_decoding/expected/ondisk_startup.out diff --git a/contrib/test_decoding/expected/permissions.out b/src/test/modules/test_decoding/expected/permissions.out similarity index 100% rename from contrib/test_decoding/expected/permissions.out rename to src/test/modules/test_decoding/expected/permissions.out diff --git a/contrib/test_decoding/expected/prepared.out b/src/test/modules/test_decoding/expected/prepared.out similarity index 100% rename from contrib/test_decoding/expected/prepared.out rename to src/test/modules/test_decoding/expected/prepared.out diff --git a/contrib/test_decoding/expected/rewrite.out b/src/test/modules/test_decoding/expected/rewrite.out similarity index 100% rename from contrib/test_decoding/expected/rewrite.out rename to src/test/modules/test_decoding/expected/rewrite.out diff --git a/contrib/test_decoding/expected/toast.out b/src/test/modules/test_decoding/expected/toast.out similarity index 100% rename from contrib/test_decoding/expected/toast.out rename to src/test/modules/test_decoding/expected/toast.out diff --git a/contrib/test_decoding/logical.conf b/src/test/modules/test_decoding/logical.conf similarity index 100% rename from contrib/test_decoding/logical.conf rename to src/test/modules/test_decoding/logical.conf diff --git a/contrib/test_decoding/specs/concurrent_ddl_dml.spec b/src/test/modules/test_decoding/specs/concurrent_ddl_dml.spec similarity index 100% rename from contrib/test_decoding/specs/concurrent_ddl_dml.spec rename to src/test/modules/test_decoding/specs/concurrent_ddl_dml.spec diff --git a/contrib/test_decoding/specs/delayed_startup.spec b/src/test/modules/test_decoding/specs/delayed_startup.spec similarity index 100% rename from contrib/test_decoding/specs/delayed_startup.spec rename to src/test/modules/test_decoding/specs/delayed_startup.spec diff --git a/contrib/test_decoding/specs/mxact.spec b/src/test/modules/test_decoding/specs/mxact.spec similarity index 100% rename from contrib/test_decoding/specs/mxact.spec rename to src/test/modules/test_decoding/specs/mxact.spec diff --git a/contrib/test_decoding/specs/ondisk_startup.spec b/src/test/modules/test_decoding/specs/ondisk_startup.spec similarity index 100% rename from contrib/test_decoding/specs/ondisk_startup.spec rename to src/test/modules/test_decoding/specs/ondisk_startup.spec diff --git a/contrib/test_decoding/sql/binary.sql b/src/test/modules/test_decoding/sql/binary.sql similarity index 100% rename from contrib/test_decoding/sql/binary.sql rename to src/test/modules/test_decoding/sql/binary.sql diff --git a/contrib/test_decoding/sql/ddl.sql b/src/test/modules/test_decoding/sql/ddl.sql similarity index 100% rename from contrib/test_decoding/sql/ddl.sql rename to src/test/modules/test_decoding/sql/ddl.sql diff --git a/contrib/test_decoding/sql/decoding_in_xact.sql b/src/test/modules/test_decoding/sql/decoding_in_xact.sql similarity index 100% rename from contrib/test_decoding/sql/decoding_in_xact.sql rename to src/test/modules/test_decoding/sql/decoding_in_xact.sql diff --git a/contrib/test_decoding/sql/decoding_into_rel.sql b/src/test/modules/test_decoding/sql/decoding_into_rel.sql similarity index 100% rename from contrib/test_decoding/sql/decoding_into_rel.sql rename to src/test/modules/test_decoding/sql/decoding_into_rel.sql diff --git a/contrib/test_decoding/sql/permissions.sql b/src/test/modules/test_decoding/sql/permissions.sql similarity index 100% rename from contrib/test_decoding/sql/permissions.sql rename to src/test/modules/test_decoding/sql/permissions.sql diff --git a/contrib/test_decoding/sql/prepared.sql b/src/test/modules/test_decoding/sql/prepared.sql similarity index 100% rename from contrib/test_decoding/sql/prepared.sql rename to src/test/modules/test_decoding/sql/prepared.sql diff --git a/contrib/test_decoding/sql/rewrite.sql b/src/test/modules/test_decoding/sql/rewrite.sql similarity index 100% rename from contrib/test_decoding/sql/rewrite.sql rename to src/test/modules/test_decoding/sql/rewrite.sql diff --git a/contrib/test_decoding/sql/toast.sql b/src/test/modules/test_decoding/sql/toast.sql similarity index 100% rename from contrib/test_decoding/sql/toast.sql rename to src/test/modules/test_decoding/sql/toast.sql diff --git a/contrib/test_decoding/test_decoding.c b/src/test/modules/test_decoding/test_decoding.c similarity index 100% rename from contrib/test_decoding/test_decoding.c rename to src/test/modules/test_decoding/test_decoding.c diff --git a/contrib/test_shm_mq/.gitignore b/src/test/modules/test_parser/.gitignore similarity index 100% rename from contrib/test_shm_mq/.gitignore rename to src/test/modules/test_parser/.gitignore diff --git a/contrib/test_parser/Makefile b/src/test/modules/test_parser/Makefile similarity index 80% rename from contrib/test_parser/Makefile rename to src/test/modules/test_parser/Makefile index 7e068ab..0c755aa 100644 --- a/contrib/test_parser/Makefile +++ b/src/test/modules/test_parser/Makefile @@ -1,4 +1,4 @@ -# contrib/test_parser/Makefile +# src/test/modules/test_parser/Makefile MODULE_big = test_parser OBJS = test_parser.o $(WIN32RES) @@ -14,8 +14,8 @@ PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else -subdir = contrib/test_parser -top_builddir = ../.. +subdir = src/test/modules/test_parser +top_builddir = ../../../.. include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif diff --git a/src/test/modules/test_parser/README b/src/test/modules/test_parser/README new file mode 100644 index 0000000..0a11ec8 --- /dev/null +++ b/src/test/modules/test_parser/README @@ -0,0 +1,61 @@ +test_parser is an example of a custom parser for full-text +search. It doesn't do anything especially useful, but can serve as +a starting point for developing your own parser. + +test_parser recognizes words separated by white space, +and returns just two token types: + +mydb=# SELECT * FROM ts_token_type('testparser'); + tokid | alias | description +-------+-------+--------------- + 3 | word | Word + 12 | blank | Space symbols +(2 rows) + +These token numbers have been chosen to be compatible with the default +parser's numbering. This allows us to use its headline() +function, thus keeping the example simple. + +Usage +===== + +Installing the test_parser extension creates a text search +parser testparser. It has no user-configurable parameters. + +You can test the parser with, for example, + +mydb=# SELECT * FROM ts_parse('testparser', 'That''s my first own parser'); + tokid | token +-------+-------- + 3 | That's + 12 | + 3 | my + 12 | + 3 | first + 12 | + 3 | own + 12 | + 3 | parser + +Real-world use requires setting up a text search configuration +that uses the parser. For example, + +mydb=# CREATE TEXT SEARCH CONFIGURATION testcfg ( PARSER = testparser ); +CREATE TEXT SEARCH CONFIGURATION + +mydb=# ALTER TEXT SEARCH CONFIGURATION testcfg +mydb-# ADD MAPPING FOR word WITH english_stem; +ALTER TEXT SEARCH CONFIGURATION + +mydb=# SELECT to_tsvector('testcfg', 'That''s my first own parser'); + to_tsvector +------------------------------- + 'that':1 'first':3 'parser':5 +(1 row) + +mydb=# SELECT ts_headline('testcfg', 'Supernovae stars are the brightest phenomena in galaxies', +mydb(# to_tsquery('testcfg', 'star')); + ts_headline +----------------------------------------------------------------- + Supernovae <b>stars</b> are the brightest phenomena in galaxies +(1 row) diff --git a/contrib/test_parser/expected/test_parser.out b/src/test/modules/test_parser/expected/test_parser.out similarity index 100% rename from contrib/test_parser/expected/test_parser.out rename to src/test/modules/test_parser/expected/test_parser.out diff --git a/contrib/test_parser/sql/test_parser.sql b/src/test/modules/test_parser/sql/test_parser.sql similarity index 100% rename from contrib/test_parser/sql/test_parser.sql rename to src/test/modules/test_parser/sql/test_parser.sql diff --git a/contrib/test_parser/test_parser--1.0.sql b/src/test/modules/test_parser/test_parser--1.0.sql similarity index 100% rename from contrib/test_parser/test_parser--1.0.sql rename to src/test/modules/test_parser/test_parser--1.0.sql diff --git a/contrib/test_parser/test_parser--unpackaged--1.0.sql b/src/test/modules/test_parser/test_parser--unpackaged--1.0.sql similarity index 100% rename from contrib/test_parser/test_parser--unpackaged--1.0.sql rename to src/test/modules/test_parser/test_parser--unpackaged--1.0.sql diff --git a/contrib/test_parser/test_parser.c b/src/test/modules/test_parser/test_parser.c similarity index 100% rename from contrib/test_parser/test_parser.c rename to src/test/modules/test_parser/test_parser.c diff --git a/contrib/test_parser/test_parser.control b/src/test/modules/test_parser/test_parser.control similarity index 100% rename from contrib/test_parser/test_parser.control rename to src/test/modules/test_parser/test_parser.control diff --git a/contrib/test_parser/.gitignore b/src/test/modules/test_shm_mq/.gitignore similarity index 100% rename from contrib/test_parser/.gitignore rename to src/test/modules/test_shm_mq/.gitignore diff --git a/contrib/test_shm_mq/Makefile b/src/test/modules/test_shm_mq/Makefile similarity index 79% rename from contrib/test_shm_mq/Makefile rename to src/test/modules/test_shm_mq/Makefile index e3c4054..11c4e35 100644 --- a/contrib/test_shm_mq/Makefile +++ b/src/test/modules/test_shm_mq/Makefile @@ -1,4 +1,4 @@ -# contrib/test_shm_mq/Makefile +# src/test/modules/test_shm_mq/Makefile MODULE_big = test_shm_mq OBJS = test.o setup.o worker.o $(WIN32RES) @@ -14,8 +14,8 @@ PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else -subdir = contrib/test_shm_mq -top_builddir = ../.. +subdir = src/test/modules/test_shm_mq +top_builddir = ../../../.. include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif diff --git a/src/test/modules/test_shm_mq/README b/src/test/modules/test_shm_mq/README new file mode 100644 index 0000000..641407b --- /dev/null +++ b/src/test/modules/test_shm_mq/README @@ -0,0 +1,49 @@ +test_shm_mq is an example of how to use dynamic shared memory +and the shared memory message queue facilities to coordinate a user backend +with the efforts of one or more background workers. It is not intended to +do anything useful on its own; rather, it is a demonstration of how these +facilities can be used, and a unit test of those facilities. + +The function is this extension send the same message repeatedly through +a loop of processes. The message payload, the size of the message queue +through which it is sent, and the number of processes in the loop are +configurable. At the end, the message may be verified to ensure that it +has not been corrupted in transmission. + +Functions +========= + + +test_shm_mq(queue_size int8, message text, + repeat_count int4 default 1, num_workers int4 default 1) + RETURNS void + +This function sends and receives messages synchronously. The user +backend sends the provided message to the first background worker using +a message queue of the given size. The first background worker sends +the message to the second background worker, if the number of workers +is greater than one, and so forth. Eventually, the last background +worker sends the message back to the user backend. If the repeat count +is greater than one, the user backend then sends the message back to +the first worker. Once the message has been sent and received by all +the coordinating processes a number of times equal to the repeat count, +the user backend verifies that the message finally received matches the +one originally sent and throws an error if not. + + +test_shm_mq_pipelined(queue_size int8, message text, + repeat_count int4 default 1, num_workers int4 default 1, + verify bool default true) + RETURNS void + +This function sends the same message multiple times, as specified by the +repeat count, to the first background worker using a queue of the given +size. These messages are then forwarded to each background worker in +turn, in each case using a queue of the given size. Finally, the last +background worker sends the messages back to the user backend. The user +backend uses non-blocking sends and receives, so that it may begin receiving +copies of the message before it has finished sending all copies of the +message. The 'verify' argument controls whether or not the +received copies are checked against the message that was sent. (This +takes nontrivial time so it may be useful to disable it for benchmarking +purposes.) diff --git a/contrib/test_shm_mq/expected/test_shm_mq.out b/src/test/modules/test_shm_mq/expected/test_shm_mq.out similarity index 100% rename from contrib/test_shm_mq/expected/test_shm_mq.out rename to src/test/modules/test_shm_mq/expected/test_shm_mq.out diff --git a/contrib/test_shm_mq/setup.c b/src/test/modules/test_shm_mq/setup.c similarity index 100% rename from contrib/test_shm_mq/setup.c rename to src/test/modules/test_shm_mq/setup.c diff --git a/contrib/test_shm_mq/sql/test_shm_mq.sql b/src/test/modules/test_shm_mq/sql/test_shm_mq.sql similarity index 100% rename from contrib/test_shm_mq/sql/test_shm_mq.sql rename to src/test/modules/test_shm_mq/sql/test_shm_mq.sql diff --git a/contrib/test_shm_mq/test.c b/src/test/modules/test_shm_mq/test.c similarity index 100% rename from contrib/test_shm_mq/test.c rename to src/test/modules/test_shm_mq/test.c diff --git a/contrib/test_shm_mq/test_shm_mq--1.0.sql b/src/test/modules/test_shm_mq/test_shm_mq--1.0.sql similarity index 100% rename from contrib/test_shm_mq/test_shm_mq--1.0.sql rename to src/test/modules/test_shm_mq/test_shm_mq--1.0.sql diff --git a/contrib/test_shm_mq/test_shm_mq.control b/src/test/modules/test_shm_mq/test_shm_mq.control similarity index 100% rename from contrib/test_shm_mq/test_shm_mq.control rename to src/test/modules/test_shm_mq/test_shm_mq.control diff --git a/contrib/test_shm_mq/test_shm_mq.h b/src/test/modules/test_shm_mq/test_shm_mq.h similarity index 100% rename from contrib/test_shm_mq/test_shm_mq.h rename to src/test/modules/test_shm_mq/test_shm_mq.h diff --git a/contrib/test_shm_mq/worker.c b/src/test/modules/test_shm_mq/worker.c similarity index 100% rename from contrib/test_shm_mq/worker.c rename to src/test/modules/test_shm_mq/worker.c diff --git a/contrib/worker_spi/Makefile b/src/test/modules/worker_spi/Makefile similarity index 75% rename from contrib/worker_spi/Makefile rename to src/test/modules/worker_spi/Makefile index 5cce4d1..7cdb33c 100644 --- a/contrib/worker_spi/Makefile +++ b/src/test/modules/worker_spi/Makefile @@ -1,4 +1,4 @@ -# contrib/worker_spi/Makefile +# src/test/modules/worker_spi/Makefile MODULES = worker_spi @@ -11,8 +11,8 @@ PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else -subdir = contrib/worker_spi -top_builddir = ../.. +subdir = src/test/modules/worker_spi +top_builddir = ../../../.. include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif diff --git a/contrib/worker_spi/worker_spi--1.0.sql b/src/test/modules/worker_spi/worker_spi--1.0.sql similarity index 100% rename from contrib/worker_spi/worker_spi--1.0.sql rename to src/test/modules/worker_spi/worker_spi--1.0.sql diff --git a/contrib/worker_spi/worker_spi.c b/src/test/modules/worker_spi/worker_spi.c similarity index 100% rename from contrib/worker_spi/worker_spi.c rename to src/test/modules/worker_spi/worker_spi.c diff --git a/contrib/worker_spi/worker_spi.control b/src/test/modules/worker_spi/worker_spi.control similarity index 100% rename from contrib/worker_spi/worker_spi.control rename to src/test/modules/worker_spi/worker_spi.control diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile index b40b37c..77fe8b6 100644 --- a/src/test/regress/GNUmakefile +++ b/src/test/regress/GNUmakefile @@ -101,7 +101,7 @@ installdirs-tests: installdirs $(MKDIR_P) $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files)))) -# Get some extra C modules from contrib/spi and contrib/dummy_seclabel... +# Get some extra C modules from contrib/spi and src/test/modules/dummy_seclabel... all: refint$(DLSUFFIX) autoinc$(DLSUFFIX) dummy_seclabel$(DLSUFFIX) @@ -111,22 +111,22 @@ refint$(DLSUFFIX): $(top_builddir)/contrib/spi/refint$(DLSUFFIX) autoinc$(DLSUFFIX): $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX) cp $< $@ -dummy_seclabel$(DLSUFFIX): $(top_builddir)/contrib/dummy_seclabel/dummy_seclabel$(DLSUFFIX) +dummy_seclabel$(DLSUFFIX): $(top_builddir)/src/test/modules/dummy_seclabel/dummy_seclabel$(DLSUFFIX) cp $< $@ $(top_builddir)/contrib/spi/refint$(DLSUFFIX): | submake-contrib-spi ; $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): | submake-contrib-spi ; -$(top_builddir)/contrib/dummy_seclabel/dummy_seclabel$(DLSUFFIX): | submake-contrib-dummy_seclabel ; +$(top_builddir)/src/test/modules/dummy_seclabel/dummy_seclabel$(DLSUFFIX): | submake-dummy_seclabel ; submake-contrib-spi: $(MAKE) -C $(top_builddir)/contrib/spi -submake-contrib-dummy_seclabel: - $(MAKE) -C $(top_builddir)/contrib/dummy_seclabel +submake-dummy_seclabel: + $(MAKE) -C $(top_builddir)/src/test/modules/dummy_seclabel -.PHONY: submake-contrib-spi submake-contrib-dummy_seclabel +.PHONY: submake-contrib-spi submake-dummy_seclabel # Tablespace setup diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index b84f70d..5b7856f 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -31,7 +31,7 @@ if (-e "src/tools/msvc/buildenv.pl") my $what = shift || ""; if ($what =~ -/^(check|installcheck|plcheck|contribcheck|ecpgcheck|isolationcheck|upgradecheck)$/i +/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck)$/i ) { $what = uc $what; @@ -76,6 +76,7 @@ my %command = ( INSTALLCHECK => \&installcheck, ECPGCHECK => \&ecpgcheck, CONTRIBCHECK => \&contribcheck, + MODULESCHECK => \&modulescheck, ISOLATIONCHECK => \&isolationcheck, UPGRADECHECK => \&upgradecheck,); @@ -247,6 +248,34 @@ sub contribcheck exit $mstat if $mstat; } +sub modulescheck +{ + chdir "../../../src/test/modules"; + my $mstat = 0; + foreach my $module (glob("*")) + { + next + unless -d "$module/sql" + && -d "$module/expected" + && (-f "$module/GNUmakefile" || -f "$module/Makefile"); + chdir $module; + print + "============================================================\n"; + print "Checking $module\n"; + my @tests = fetchTests(); + my @opts = fetchRegressOpts(); + my @args = ( + "../../../../$Config/pg_regress/pg_regress", + "--psqldir=../../../../$Config/psql", + "--dbname=modules_regression", @opts, @tests); + system(@args); + my $status = $? >> 8; + $mstat ||= $status; + chdir ".."; + } + exit $mstat if $mstat; +} + sub upgradecheck { my $status;
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers