diff options
| author | Bruce Momjian <bruce@momjian.us> | 2002-08-15 02:51:27 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2002-08-15 02:51:27 +0000 |
| commit | 45e25445846e98fe4aac23d1073566c08cd62f0b (patch) | |
| tree | 7db989a91d752dca0a014eaaa6b160cb04b08b1c /contrib/tablefunc/tablefunc.sql.in | |
| parent | 4c4854c4583f1d7c3d0a28b714304e433f5571e8 (diff) | |
| download | postgresql-45e25445846e98fe4aac23d1073566c08cd62f0b.tar.gz | |
As discussed on several occasions previously, the new anonymous
composite type capability makes it possible to create a system view
based on a table function in a way that is hopefully palatable to
everyone. The attached patch takes advantage of this, moving
show_all_settings() from contrib/tablefunc into the backend (renamed
all_settings(). It is defined as a builtin returning type RECORD. During
initdb a system view is created to expose the same information presently
available through SHOW ALL. For example:
test=# select * from pg_settings where name like '%debug%';
name | setting
-----------------------+---------
debug_assertions | on
debug_pretty_print | off
debug_print_parse | off
debug_print_plan | off
debug_print_query | off
debug_print_rewritten | off
wal_debug | 0
(7 rows)
Additionally during initdb two rules are created which make it possible
to change settings by updating the system view -- a "virtual table" as
Tom put it. Here's an example:
Joe Conway
Diffstat (limited to 'contrib/tablefunc/tablefunc.sql.in')
| -rw-r--r-- | contrib/tablefunc/tablefunc.sql.in | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/contrib/tablefunc/tablefunc.sql.in b/contrib/tablefunc/tablefunc.sql.in index 746e8f9cff..7d599d4f08 100644 --- a/contrib/tablefunc/tablefunc.sql.in +++ b/contrib/tablefunc/tablefunc.sql.in @@ -1,12 +1,3 @@ -CREATE VIEW tablefunc_config_settings AS - SELECT - ''::TEXT AS name, - ''::TEXT AS setting; - -CREATE OR REPLACE FUNCTION show_all_settings() - RETURNS setof tablefunc_config_settings - AS 'MODULE_PATHNAME','show_all_settings' LANGUAGE 'c' STABLE STRICT; - CREATE OR REPLACE FUNCTION normal_rand(int4, float8, float8, int4) RETURNS setof float8 AS 'MODULE_PATHNAME','normal_rand' LANGUAGE 'c' VOLATILE STRICT; @@ -44,3 +35,6 @@ CREATE OR REPLACE FUNCTION crosstab4(text) RETURNS setof tablefunc_crosstab_4 AS 'MODULE_PATHNAME','crosstab' LANGUAGE 'c' STABLE STRICT; +CREATE OR REPLACE FUNCTION crosstab(text,int) + RETURNS setof record + AS 'MODULE_PATHNAME','crosstab' LANGUAGE 'c' STABLE STRICT;
\ No newline at end of file |
