Commit 0b7e660d authored by Tom Lane's avatar Tom Lane

Fix ruleutils pretty-printing to not generate trailing whitespace.

The pretty-printing logic in ruleutils.c operates by inserting a newline
and some indentation whitespace into strings that are already valid SQL.
This naturally results in leaving some trailing whitespace before the
newline in many cases; which can be annoying when processing the output
with other tools, as complained of by Joe Abbate.  We can fix that in
a pretty localized fashion by deleting any trailing whitespace before
we append a pretty-printing newline.  In addition, we have to modify the
code inserted by commit 2f582f76 so that
we also delete trailing whitespace when transposing items from temporary
buffers into the main result string, when a temporary item starts with a
newline.

This results in rather voluminous changes to the regression test results,
but it's easily verified that they are only removal of trailing whitespace.

Back-patch to 9.3, because the aforementioned commit resulted in many
more cases of trailing whitespace than had occurred in earlier branches.
parent 648bd05b
...@@ -365,6 +365,7 @@ static const char *get_simple_binary_op_name(OpExpr *expr); ...@@ -365,6 +365,7 @@ static const char *get_simple_binary_op_name(OpExpr *expr);
static bool isSimpleNode(Node *node, Node *parentNode, int prettyFlags); static bool isSimpleNode(Node *node, Node *parentNode, int prettyFlags);
static void appendContextKeyword(deparse_context *context, const char *str, static void appendContextKeyword(deparse_context *context, const char *str,
int indentBefore, int indentAfter, int indentPlus); int indentBefore, int indentAfter, int indentPlus);
static void removeStringInfoSpaces(StringInfo str);
static void get_rule_expr(Node *node, deparse_context *context, static void get_rule_expr(Node *node, deparse_context *context,
bool showimplicit); bool showimplicit);
static void get_oper_expr(OpExpr *expr, deparse_context *context); static void get_oper_expr(OpExpr *expr, deparse_context *context);
...@@ -4479,42 +4480,42 @@ get_target_list(List *targetList, deparse_context *context, ...@@ -4479,42 +4480,42 @@ get_target_list(List *targetList, deparse_context *context,
/* Consider line-wrapping if enabled */ /* Consider line-wrapping if enabled */
if (PRETTY_INDENT(context) && context->wrapColumn >= 0) if (PRETTY_INDENT(context) && context->wrapColumn >= 0)
{ {
int leading_nl_pos = -1; int leading_nl_pos;
char *trailing_nl;
int pos;
/* Does the new field start with whitespace plus a new line? */ /* Does the new field start with a new line? */
for (pos = 0; pos < targetbuf.len; pos++) if (targetbuf.len > 0 && targetbuf.data[0] == '\n')
leading_nl_pos = 0;
else
leading_nl_pos = -1;
/* If so, we shouldn't add anything */
if (leading_nl_pos >= 0)
{ {
if (targetbuf.data[pos] == '\n') /* instead, remove any trailing spaces currently in buf */
{ removeStringInfoSpaces(buf);
leading_nl_pos = pos;
break;
}
if (targetbuf.data[pos] != ' ')
break;
} }
/* Locate the start of the current line in the output buffer */
trailing_nl = strrchr(buf->data, '\n');
if (trailing_nl == NULL)
trailing_nl = buf->data;
else else
trailing_nl++; {
char *trailing_nl;
/* /* Locate the start of the current line in the output buffer */
* If the field we're adding is the first in the list, or it trailing_nl = strrchr(buf->data, '\n');
* already has a leading newline, don't add anything. Otherwise, if (trailing_nl == NULL)
* add a newline, plus some indentation, if either the new field trailing_nl = buf->data;
* would cause an overflow or the last field used more than one else
* line. trailing_nl++;
*/
if (colno > 1 && /*
leading_nl_pos == -1 && * Add a newline, plus some indentation, if the new field is
((strlen(trailing_nl) + strlen(targetbuf.data) > context->wrapColumn) || * not the first and either the new field would cause an
last_was_multiline)) * overflow or the last field used more than one line.
appendContextKeyword(context, "", -PRETTYINDENT_STD, */
PRETTYINDENT_STD, PRETTYINDENT_VAR); if (colno > 1 &&
((strlen(trailing_nl) + targetbuf.len > context->wrapColumn) ||
last_was_multiline))
appendContextKeyword(context, "", -PRETTYINDENT_STD,
PRETTYINDENT_STD, PRETTYINDENT_VAR);
}
/* Remember this field's multiline status for next iteration */ /* Remember this field's multiline status for next iteration */
last_was_multiline = last_was_multiline =
...@@ -6236,23 +6237,42 @@ static void ...@@ -6236,23 +6237,42 @@ static void
appendContextKeyword(deparse_context *context, const char *str, appendContextKeyword(deparse_context *context, const char *str,
int indentBefore, int indentAfter, int indentPlus) int indentBefore, int indentAfter, int indentPlus)
{ {
StringInfo buf = context->buf;
if (PRETTY_INDENT(context)) if (PRETTY_INDENT(context))
{ {
context->indentLevel += indentBefore; context->indentLevel += indentBefore;
appendStringInfoChar(context->buf, '\n'); /* remove any trailing spaces currently in the buffer ... */
appendStringInfoSpaces(context->buf, removeStringInfoSpaces(buf);
/* ... then add a newline and some spaces */
appendStringInfoChar(buf, '\n');
appendStringInfoSpaces(buf,
Max(context->indentLevel, 0) + indentPlus); Max(context->indentLevel, 0) + indentPlus);
appendStringInfoString(context->buf, str);
appendStringInfoString(buf, str);
context->indentLevel += indentAfter; context->indentLevel += indentAfter;
if (context->indentLevel < 0) if (context->indentLevel < 0)
context->indentLevel = 0; context->indentLevel = 0;
} }
else else
appendStringInfoString(context->buf, str); appendStringInfoString(buf, str);
} }
/*
* removeStringInfoSpaces - delete trailing spaces from a buffer.
*
* Possibly this should move to stringinfo.c at some point.
*/
static void
removeStringInfoSpaces(StringInfo str)
{
while (str->len > 0 && str->data[str->len - 1] == ' ')
str->data[--(str->len)] = '\0';
}
/* /*
* get_rule_expr_paren - deparse expr using get_rule_expr, * get_rule_expr_paren - deparse expr using get_rule_expr,
* embracing the string with parentheses if necessary for prettyPrint. * embracing the string with parentheses if necessary for prettyPrint.
...@@ -7942,22 +7962,33 @@ get_from_clause(Query *query, const char *prefix, deparse_context *context) ...@@ -7942,22 +7962,33 @@ get_from_clause(Query *query, const char *prefix, deparse_context *context)
/* Consider line-wrapping if enabled */ /* Consider line-wrapping if enabled */
if (PRETTY_INDENT(context) && context->wrapColumn >= 0) if (PRETTY_INDENT(context) && context->wrapColumn >= 0)
{ {
char *trailing_nl; /* Does the new item start with a new line? */
if (itembuf.len > 0 && itembuf.data[0] == '\n')
/* Locate the start of the current line in the buffer */ {
trailing_nl = strrchr(buf->data, '\n'); /* If so, we shouldn't add anything */
if (trailing_nl == NULL) /* instead, remove any trailing spaces currently in buf */
trailing_nl = buf->data; removeStringInfoSpaces(buf);
}
else else
trailing_nl++; {
char *trailing_nl;
/* /* Locate the start of the current line in the buffer */
* Add a newline, plus some indentation, if the new item would trailing_nl = strrchr(buf->data, '\n');
* cause an overflow. if (trailing_nl == NULL)
*/ trailing_nl = buf->data;
if (strlen(trailing_nl) + strlen(itembuf.data) > context->wrapColumn) else
appendContextKeyword(context, "", -PRETTYINDENT_STD, trailing_nl++;
PRETTYINDENT_STD, PRETTYINDENT_VAR);
/*
* Add a newline, plus some indentation, if the new item
* would cause an overflow.
*/
if (strlen(trailing_nl) + itembuf.len > context->wrapColumn)
appendContextKeyword(context, "", -PRETTYINDENT_STD,
PRETTYINDENT_STD,
PRETTYINDENT_VAR);
}
} }
/* Add the new item */ /* Add the new item */
......
...@@ -960,10 +960,10 @@ select * from agg_view1; ...@@ -960,10 +960,10 @@ select * from agg_view1;
(1 row) (1 row)
select pg_get_viewdef('agg_view1'::regclass); select pg_get_viewdef('agg_view1'::regclass);
pg_get_viewdef pg_get_viewdef
---------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------
SELECT aggfns(DISTINCT v.a, v.b, v.c) AS aggfns + SELECT aggfns(DISTINCT v.a, v.b, v.c) AS aggfns +
FROM ( VALUES (1,3,'foo'::text), (0,NULL::integer,NULL::text), (2,2,'bar'::text), (3,1,'baz'::text)) v(a, b, c), + FROM ( VALUES (1,3,'foo'::text), (0,NULL::integer,NULL::text), (2,2,'bar'::text), (3,1,'baz'::text)) v(a, b, c),+
generate_series(1, 3) i(i); generate_series(1, 3) i(i);
(1 row) (1 row)
...@@ -978,10 +978,10 @@ select * from agg_view1; ...@@ -978,10 +978,10 @@ select * from agg_view1;
(1 row) (1 row)
select pg_get_viewdef('agg_view1'::regclass); select pg_get_viewdef('agg_view1'::regclass);
pg_get_viewdef pg_get_viewdef
---------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------
SELECT aggfns(DISTINCT v.a, v.b, v.c ORDER BY v.b) AS aggfns + SELECT aggfns(DISTINCT v.a, v.b, v.c ORDER BY v.b) AS aggfns +
FROM ( VALUES (1,3,'foo'::text), (0,NULL::integer,NULL::text), (2,2,'bar'::text), (3,1,'baz'::text)) v(a, b, c), + FROM ( VALUES (1,3,'foo'::text), (0,NULL::integer,NULL::text), (2,2,'bar'::text), (3,1,'baz'::text)) v(a, b, c),+
generate_series(1, 3) i(i); generate_series(1, 3) i(i);
(1 row) (1 row)
...@@ -1044,10 +1044,10 @@ select * from agg_view1; ...@@ -1044,10 +1044,10 @@ select * from agg_view1;
(1 row) (1 row)
select pg_get_viewdef('agg_view1'::regclass); select pg_get_viewdef('agg_view1'::regclass);
pg_get_viewdef pg_get_viewdef
---------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------
SELECT aggfns(DISTINCT v.a, v.b, v.c ORDER BY v.a, v.c USING ~<~ NULLS LAST, v.b) AS aggfns + SELECT aggfns(DISTINCT v.a, v.b, v.c ORDER BY v.a, v.c USING ~<~ NULLS LAST, v.b) AS aggfns +
FROM ( VALUES (1,3,'foo'::text), (0,NULL::integer,NULL::text), (2,2,'bar'::text), (3,1,'baz'::text)) v(a, b, c), + FROM ( VALUES (1,3,'foo'::text), (0,NULL::integer,NULL::text), (2,2,'bar'::text), (3,1,'baz'::text)) v(a, b, c),+
generate_series(1, 2) i(i); generate_series(1, 2) i(i);
(1 row) (1 row)
......
...@@ -312,8 +312,8 @@ CREATE VIEW aliased_view_4 AS ...@@ -312,8 +312,8 @@ CREATE VIEW aliased_view_4 AS
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tt1.f1, SELECT tt1.f1,
tt1.f2, tt1.f2,
tt1.f3 tt1.f3
FROM tt1 FROM tt1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -328,8 +328,8 @@ View definition: ...@@ -328,8 +328,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT a1.f1, SELECT a1.f1,
a1.f2, a1.f2,
a1.f3 a1.f3
FROM tt1 a1 FROM tt1 a1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -344,8 +344,8 @@ View definition: ...@@ -344,8 +344,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tt1.f1, SELECT tt1.f1,
tt1.f2, tt1.f2,
tt1.f3 tt1.f3
FROM tt1 FROM tt1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -360,8 +360,8 @@ View definition: ...@@ -360,8 +360,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tt1.y1, SELECT tt1.y1,
tt1.f2, tt1.f2,
tt1.f3 tt1.f3
FROM temp_view_test.tt1 FROM temp_view_test.tt1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -377,8 +377,8 @@ ALTER TABLE tx1 RENAME TO a1; ...@@ -377,8 +377,8 @@ ALTER TABLE tx1 RENAME TO a1;
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tt1.f1, SELECT tt1.f1,
tt1.f2, tt1.f2,
tt1.f3 tt1.f3
FROM tt1 FROM tt1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -393,8 +393,8 @@ View definition: ...@@ -393,8 +393,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT a1.f1, SELECT a1.f1,
a1.f2, a1.f2,
a1.f3 a1.f3
FROM tt1 a1 FROM tt1 a1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -409,8 +409,8 @@ View definition: ...@@ -409,8 +409,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tt1.f1, SELECT tt1.f1,
tt1.f2, tt1.f2,
tt1.f3 tt1.f3
FROM tt1 FROM tt1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -425,8 +425,8 @@ View definition: ...@@ -425,8 +425,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tt1.y1, SELECT tt1.y1,
tt1.f2, tt1.f2,
tt1.f3 tt1.f3
FROM temp_view_test.tt1 FROM temp_view_test.tt1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -442,8 +442,8 @@ ALTER TABLE tt1 RENAME TO a2; ...@@ -442,8 +442,8 @@ ALTER TABLE tt1 RENAME TO a2;
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT a2.f1, SELECT a2.f1,
a2.f2, a2.f2,
a2.f3 a2.f3
FROM a2 FROM a2
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -458,8 +458,8 @@ View definition: ...@@ -458,8 +458,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT a1.f1, SELECT a1.f1,
a1.f2, a1.f2,
a1.f3 a1.f3
FROM a2 a1 FROM a2 a1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -474,8 +474,8 @@ View definition: ...@@ -474,8 +474,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT a2.f1, SELECT a2.f1,
a2.f2, a2.f2,
a2.f3 a2.f3
FROM a2 FROM a2
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -490,8 +490,8 @@ View definition: ...@@ -490,8 +490,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tt1.y1, SELECT tt1.y1,
tt1.f2, tt1.f2,
tt1.f3 tt1.f3
FROM temp_view_test.tt1 FROM temp_view_test.tt1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -507,8 +507,8 @@ ALTER TABLE a1 RENAME TO tt1; ...@@ -507,8 +507,8 @@ ALTER TABLE a1 RENAME TO tt1;
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT a2.f1, SELECT a2.f1,
a2.f2, a2.f2,
a2.f3 a2.f3
FROM a2 FROM a2
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -523,8 +523,8 @@ View definition: ...@@ -523,8 +523,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT a1.f1, SELECT a1.f1,
a1.f2, a1.f2,
a1.f3 a1.f3
FROM a2 a1 FROM a2 a1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -539,8 +539,8 @@ View definition: ...@@ -539,8 +539,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT a2.f1, SELECT a2.f1,
a2.f2, a2.f2,
a2.f3 a2.f3
FROM a2 FROM a2
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -555,8 +555,8 @@ View definition: ...@@ -555,8 +555,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tt1.y1, SELECT tt1.y1,
tt1.f2, tt1.f2,
tt1.f3 tt1.f3
FROM temp_view_test.tt1 FROM temp_view_test.tt1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -573,8 +573,8 @@ ALTER TABLE tx1 SET SCHEMA temp_view_test; ...@@ -573,8 +573,8 @@ ALTER TABLE tx1 SET SCHEMA temp_view_test;
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tx1.f1, SELECT tx1.f1,
tx1.f2, tx1.f2,
tx1.f3 tx1.f3
FROM temp_view_test.tx1 FROM temp_view_test.tx1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -589,8 +589,8 @@ View definition: ...@@ -589,8 +589,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT a1.f1, SELECT a1.f1,
a1.f2, a1.f2,
a1.f3 a1.f3
FROM temp_view_test.tx1 a1 FROM temp_view_test.tx1 a1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -605,8 +605,8 @@ View definition: ...@@ -605,8 +605,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tx1.f1, SELECT tx1.f1,
tx1.f2, tx1.f2,
tx1.f3 tx1.f3
FROM temp_view_test.tx1 FROM temp_view_test.tx1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -621,8 +621,8 @@ View definition: ...@@ -621,8 +621,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tt1.y1, SELECT tt1.y1,
tt1.f2, tt1.f2,
tt1.f3 tt1.f3
FROM temp_view_test.tt1 FROM temp_view_test.tt1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -640,8 +640,8 @@ ALTER TABLE tmp1 RENAME TO tx1; ...@@ -640,8 +640,8 @@ ALTER TABLE tmp1 RENAME TO tx1;
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tx1.f1, SELECT tx1.f1,
tx1.f2, tx1.f2,
tx1.f3 tx1.f3
FROM temp_view_test.tx1 FROM temp_view_test.tx1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -656,8 +656,8 @@ View definition: ...@@ -656,8 +656,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT a1.f1, SELECT a1.f1,
a1.f2, a1.f2,
a1.f3 a1.f3
FROM temp_view_test.tx1 a1 FROM temp_view_test.tx1 a1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -672,8 +672,8 @@ View definition: ...@@ -672,8 +672,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tx1.f1, SELECT tx1.f1,
tx1.f2, tx1.f2,
tx1.f3 tx1.f3
FROM temp_view_test.tx1 FROM temp_view_test.tx1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
...@@ -688,8 +688,8 @@ View definition: ...@@ -688,8 +688,8 @@ View definition:
f2 | integer | | plain | f2 | integer | | plain |
f3 | text | | extended | f3 | text | | extended |
View definition: View definition:
SELECT tx1.y1, SELECT tx1.y1,
tx1.f2, tx1.f2,
tx1.f3 tx1.f3
FROM tx1 FROM tx1
WHERE (EXISTS ( SELECT 1 WHERE (EXISTS ( SELECT 1
......
...@@ -97,7 +97,7 @@ CREATE INDEX aa ON bb (grandtot); ...@@ -97,7 +97,7 @@ CREATE INDEX aa ON bb (grandtot);
type | text | | extended | | type | text | | extended | |
totamt | numeric | | main | | totamt | numeric | | main | |
View definition: View definition:
SELECT tv.type, SELECT tv.type,
tv.totamt tv.totamt
FROM tv FROM tv
ORDER BY tv.type; ORDER BY tv.type;
...@@ -109,7 +109,7 @@ View definition: ...@@ -109,7 +109,7 @@ View definition:
type | text | | extended | | type | text | | extended | |
totamt | numeric | | main | | totamt | numeric | | main | |
View definition: View definition:
SELECT tv.type, SELECT tv.type,
tv.totamt tv.totamt
FROM tv FROM tv
ORDER BY tv.type; ORDER BY tv.type;
...@@ -158,7 +158,7 @@ SET search_path = mvschema, public; ...@@ -158,7 +158,7 @@ SET search_path = mvschema, public;
type | text | | extended | | type | text | | extended | |
totamt | numeric | | main | | totamt | numeric | | main | |
View definition: View definition:
SELECT tv.type, SELECT tv.type,
tv.totamt tv.totamt
FROM tv FROM tv
ORDER BY tv.type; ORDER BY tv.type;
...@@ -343,11 +343,11 @@ CREATE VIEW v_test2 AS SELECT moo, 2*moo FROM v_test1 UNION ALL SELECT moo, 3*mo ...@@ -343,11 +343,11 @@ CREATE VIEW v_test2 AS SELECT moo, 2*moo FROM v_test1 UNION ALL SELECT moo, 3*mo
moo | integer | | plain | moo | integer | | plain |
?column? | integer | | plain | ?column? | integer | | plain |
View definition: View definition:
SELECT v_test1.moo, SELECT v_test1.moo,
2 * v_test1.moo 2 * v_test1.moo
FROM v_test1 FROM v_test1
UNION ALL UNION ALL
SELECT v_test1.moo, SELECT v_test1.moo,
3 * v_test1.moo 3 * v_test1.moo
FROM v_test1; FROM v_test1;
...@@ -359,11 +359,11 @@ CREATE MATERIALIZED VIEW mv_test2 AS SELECT moo, 2*moo FROM v_test2 UNION ALL SE ...@@ -359,11 +359,11 @@ CREATE MATERIALIZED VIEW mv_test2 AS SELECT moo, 2*moo FROM v_test2 UNION ALL SE
moo | integer | | plain | | moo | integer | | plain | |
?column? | integer | | plain | | ?column? | integer | | plain | |
View definition: View definition:
SELECT v_test2.moo, SELECT v_test2.moo,
2 * v_test2.moo 2 * v_test2.moo
FROM v_test2 FROM v_test2
UNION ALL UNION ALL
SELECT v_test2.moo, SELECT v_test2.moo,
3 * v_test2.moo 3 * v_test2.moo
FROM v_test2; FROM v_test2;
......
...@@ -1381,9 +1381,9 @@ select * from dfview; ...@@ -1381,9 +1381,9 @@ select * from dfview;
c3 | bigint | | plain | c3 | bigint | | plain |
c4 | bigint | | plain | c4 | bigint | | plain |
View definition: View definition:
SELECT int8_tbl.q1, SELECT int8_tbl.q1,
int8_tbl.q2, int8_tbl.q2,
dfunc(int8_tbl.q1, int8_tbl.q2, flag := int8_tbl.q1 > int8_tbl.q2) AS c3, dfunc(int8_tbl.q1, int8_tbl.q2, flag := int8_tbl.q1 > int8_tbl.q2) AS c3,
dfunc(int8_tbl.q1, flag := int8_tbl.q1 < int8_tbl.q2, b := int8_tbl.q2) AS c4 dfunc(int8_tbl.q1, flag := int8_tbl.q1 < int8_tbl.q2, b := int8_tbl.q2) AS c4
FROM int8_tbl; FROM int8_tbl;
......
...@@ -1279,46 +1279,46 @@ drop table cchild; ...@@ -1279,46 +1279,46 @@ drop table cchild;
-- temporarily disable fancy output, so view changes create less diff noise -- temporarily disable fancy output, so view changes create less diff noise
\a\t \a\t
SELECT viewname, definition FROM pg_views WHERE schemaname <> 'information_schema' ORDER BY viewname; SELECT viewname, definition FROM pg_views WHERE schemaname <> 'information_schema' ORDER BY viewname;
iexit| SELECT ih.name, iexit| SELECT ih.name,
ih.thepath, ih.thepath,
interpt_pp(ih.thepath, r.thepath) AS exit interpt_pp(ih.thepath, r.thepath) AS exit
FROM ihighway ih, FROM ihighway ih,
ramp r ramp r
WHERE (ih.thepath ## r.thepath); WHERE (ih.thepath ## r.thepath);
pg_available_extension_versions| SELECT e.name, pg_available_extension_versions| SELECT e.name,
e.version, e.version,
(x.extname IS NOT NULL) AS installed, (x.extname IS NOT NULL) AS installed,
e.superuser, e.superuser,
e.relocatable, e.relocatable,
e.schema, e.schema,
e.requires, e.requires,
e.comment e.comment
FROM (pg_available_extension_versions() e(name, version, superuser, relocatable, schema, requires, comment) FROM (pg_available_extension_versions() e(name, version, superuser, relocatable, schema, requires, comment)
LEFT JOIN pg_extension x ON (((e.name = x.extname) AND (e.version = x.extversion)))); LEFT JOIN pg_extension x ON (((e.name = x.extname) AND (e.version = x.extversion))));
pg_available_extensions| SELECT e.name, pg_available_extensions| SELECT e.name,
e.default_version, e.default_version,
x.extversion AS installed_version, x.extversion AS installed_version,
e.comment e.comment
FROM (pg_available_extensions() e(name, default_version, comment) FROM (pg_available_extensions() e(name, default_version, comment)
LEFT JOIN pg_extension x ON ((e.name = x.extname))); LEFT JOIN pg_extension x ON ((e.name = x.extname)));
pg_cursors| SELECT c.name, pg_cursors| SELECT c.name,
c.statement, c.statement,
c.is_holdable, c.is_holdable,
c.is_binary, c.is_binary,
c.is_scrollable, c.is_scrollable,
c.creation_time c.creation_time
FROM pg_cursor() c(name, statement, is_holdable, is_binary, is_scrollable, creation_time); FROM pg_cursor() c(name, statement, is_holdable, is_binary, is_scrollable, creation_time);
pg_group| SELECT pg_authid.rolname AS groname, pg_group| SELECT pg_authid.rolname AS groname,
pg_authid.oid AS grosysid, pg_authid.oid AS grosysid,
ARRAY( SELECT pg_auth_members.member ARRAY( SELECT pg_auth_members.member
FROM pg_auth_members FROM pg_auth_members
WHERE (pg_auth_members.roleid = pg_authid.oid)) AS grolist WHERE (pg_auth_members.roleid = pg_authid.oid)) AS grolist
FROM pg_authid FROM pg_authid
WHERE (NOT pg_authid.rolcanlogin); WHERE (NOT pg_authid.rolcanlogin);
pg_indexes| SELECT n.nspname AS schemaname, pg_indexes| SELECT n.nspname AS schemaname,
c.relname AS tablename, c.relname AS tablename,
i.relname AS indexname, i.relname AS indexname,
t.spcname AS tablespace, t.spcname AS tablespace,
pg_get_indexdef(i.oid) AS indexdef pg_get_indexdef(i.oid) AS indexdef
FROM ((((pg_index x FROM ((((pg_index x
JOIN pg_class c ON ((c.oid = x.indrelid))) JOIN pg_class c ON ((c.oid = x.indrelid)))
...@@ -1326,73 +1326,73 @@ pg_indexes| SELECT n.nspname AS schemaname, ...@@ -1326,73 +1326,73 @@ pg_indexes| SELECT n.nspname AS schemaname,
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
LEFT JOIN pg_tablespace t ON ((t.oid = i.reltablespace))) LEFT JOIN pg_tablespace t ON ((t.oid = i.reltablespace)))
WHERE ((c.relkind = ANY (ARRAY['r'::"char", 'm'::"char"])) AND (i.relkind = 'i'::"char")); WHERE ((c.relkind = ANY (ARRAY['r'::"char", 'm'::"char"])) AND (i.relkind = 'i'::"char"));
pg_locks| SELECT l.locktype, pg_locks| SELECT l.locktype,
l.database, l.database,
l.relation, l.relation,
l.page, l.page,
l.tuple, l.tuple,
l.virtualxid, l.virtualxid,
l.transactionid, l.transactionid,
l.classid, l.classid,
l.objid, l.objid,
l.objsubid, l.objsubid,
l.virtualtransaction, l.virtualtransaction,
l.pid, l.pid,
l.mode, l.mode,
l.granted, l.granted,
l.fastpath l.fastpath
FROM pg_lock_status() l(locktype, database, relation, page, tuple, virtualxid, transactionid, classid, objid, objsubid, virtualtransaction, pid, mode, granted, fastpath); FROM pg_lock_status() l(locktype, database, relation, page, tuple, virtualxid, transactionid, classid, objid, objsubid, virtualtransaction, pid, mode, granted, fastpath);
pg_matviews| SELECT n.nspname AS schemaname, pg_matviews| SELECT n.nspname AS schemaname,
c.relname AS matviewname, c.relname AS matviewname,
pg_get_userbyid(c.relowner) AS matviewowner, pg_get_userbyid(c.relowner) AS matviewowner,
t.spcname AS tablespace, t.spcname AS tablespace,
c.relhasindex AS hasindexes, c.relhasindex AS hasindexes,
c.relispopulated AS ispopulated, c.relispopulated AS ispopulated,
pg_get_viewdef(c.oid) AS definition pg_get_viewdef(c.oid) AS definition
FROM ((pg_class c FROM ((pg_class c
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
LEFT JOIN pg_tablespace t ON ((t.oid = c.reltablespace))) LEFT JOIN pg_tablespace t ON ((t.oid = c.reltablespace)))
WHERE (c.relkind = 'm'::"char"); WHERE (c.relkind = 'm'::"char");
pg_prepared_statements| SELECT p.name, pg_prepared_statements| SELECT p.name,
p.statement, p.statement,
p.prepare_time, p.prepare_time,
p.parameter_types, p.parameter_types,
p.from_sql p.from_sql
FROM pg_prepared_statement() p(name, statement, prepare_time, parameter_types, from_sql); FROM pg_prepared_statement() p(name, statement, prepare_time, parameter_types, from_sql);
pg_prepared_xacts| SELECT p.transaction, pg_prepared_xacts| SELECT p.transaction,
p.gid, p.gid,
p.prepared, p.prepared,
u.rolname AS owner, u.rolname AS owner,
d.datname AS database d.datname AS database
FROM ((pg_prepared_xact() p(transaction, gid, prepared, ownerid, dbid) FROM ((pg_prepared_xact() p(transaction, gid, prepared, ownerid, dbid)
LEFT JOIN pg_authid u ON ((p.ownerid = u.oid))) LEFT JOIN pg_authid u ON ((p.ownerid = u.oid)))
LEFT JOIN pg_database d ON ((p.dbid = d.oid))); LEFT JOIN pg_database d ON ((p.dbid = d.oid)));
pg_roles| SELECT pg_authid.rolname, pg_roles| SELECT pg_authid.rolname,
pg_authid.rolsuper, pg_authid.rolsuper,
pg_authid.rolinherit, pg_authid.rolinherit,
pg_authid.rolcreaterole, pg_authid.rolcreaterole,
pg_authid.rolcreatedb, pg_authid.rolcreatedb,
pg_authid.rolcatupdate, pg_authid.rolcatupdate,
pg_authid.rolcanlogin, pg_authid.rolcanlogin,
pg_authid.rolreplication, pg_authid.rolreplication,
pg_authid.rolconnlimit, pg_authid.rolconnlimit,
'********'::text AS rolpassword, '********'::text AS rolpassword,
pg_authid.rolvaliduntil, pg_authid.rolvaliduntil,
s.setconfig AS rolconfig, s.setconfig AS rolconfig,
pg_authid.oid pg_authid.oid
FROM (pg_authid FROM (pg_authid
LEFT JOIN pg_db_role_setting s ON (((pg_authid.oid = s.setrole) AND (s.setdatabase = (0)::oid)))); LEFT JOIN pg_db_role_setting s ON (((pg_authid.oid = s.setrole) AND (s.setdatabase = (0)::oid))));
pg_rules| SELECT n.nspname AS schemaname, pg_rules| SELECT n.nspname AS schemaname,
c.relname AS tablename, c.relname AS tablename,
r.rulename, r.rulename,
pg_get_ruledef(r.oid) AS definition pg_get_ruledef(r.oid) AS definition
FROM ((pg_rewrite r FROM ((pg_rewrite r
JOIN pg_class c ON ((c.oid = r.ev_class))) JOIN pg_class c ON ((c.oid = r.ev_class)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (r.rulename <> '_RETURN'::name); WHERE (r.rulename <> '_RETURN'::name);
pg_seclabels| ( ( ( ( ( ( ( ( ( SELECT l.objoid, pg_seclabels| ( ( ( ( ( ( ( ( ( SELECT l.objoid,
l.classoid, l.classoid,
l.objsubid, l.objsubid,
CASE CASE
WHEN (rel.relkind = 'r'::"char") THEN 'table'::text WHEN (rel.relkind = 'r'::"char") THEN 'table'::text
WHEN (rel.relkind = 'v'::"char") THEN 'view'::text WHEN (rel.relkind = 'v'::"char") THEN 'view'::text
...@@ -1400,462 +1400,462 @@ pg_seclabels| ( ( ( ( ( ( ( ...@@ -1400,462 +1400,462 @@ pg_seclabels| ( ( ( ( ( ( (
WHEN (rel.relkind = 'S'::"char") THEN 'sequence'::text WHEN (rel.relkind = 'S'::"char") THEN 'sequence'::text
WHEN (rel.relkind = 'f'::"char") THEN 'foreign table'::text WHEN (rel.relkind = 'f'::"char") THEN 'foreign table'::text
ELSE NULL::text ELSE NULL::text
END AS objtype, END AS objtype,
rel.relnamespace AS objnamespace, rel.relnamespace AS objnamespace,
CASE CASE
WHEN pg_table_is_visible(rel.oid) THEN quote_ident((rel.relname)::text) WHEN pg_table_is_visible(rel.oid) THEN quote_ident((rel.relname)::text)
ELSE ((quote_ident((nsp.nspname)::text) || '.'::text) || quote_ident((rel.relname)::text)) ELSE ((quote_ident((nsp.nspname)::text) || '.'::text) || quote_ident((rel.relname)::text))
END AS objname, END AS objname,
l.provider, l.provider,
l.label l.label
FROM ((pg_seclabel l FROM ((pg_seclabel l
JOIN pg_class rel ON (((l.classoid = rel.tableoid) AND (l.objoid = rel.oid)))) JOIN pg_class rel ON (((l.classoid = rel.tableoid) AND (l.objoid = rel.oid))))
JOIN pg_namespace nsp ON ((rel.relnamespace = nsp.oid))) JOIN pg_namespace nsp ON ((rel.relnamespace = nsp.oid)))
WHERE (l.objsubid = 0) WHERE (l.objsubid = 0)
UNION ALL UNION ALL
SELECT l.objoid, SELECT l.objoid,
l.classoid, l.classoid,
l.objsubid, l.objsubid,
'column'::text AS objtype, 'column'::text AS objtype,
rel.relnamespace AS objnamespace, rel.relnamespace AS objnamespace,
(( ((
CASE CASE
WHEN pg_table_is_visible(rel.oid) THEN quote_ident((rel.relname)::text) WHEN pg_table_is_visible(rel.oid) THEN quote_ident((rel.relname)::text)
ELSE ((quote_ident((nsp.nspname)::text) || '.'::text) || quote_ident((rel.relname)::text)) ELSE ((quote_ident((nsp.nspname)::text) || '.'::text) || quote_ident((rel.relname)::text))
END || '.'::text) || (att.attname)::text) AS objname, END || '.'::text) || (att.attname)::text) AS objname,
l.provider, l.provider,
l.label l.label
FROM (((pg_seclabel l FROM (((pg_seclabel l
JOIN pg_class rel ON (((l.classoid = rel.tableoid) AND (l.objoid = rel.oid)))) JOIN pg_class rel ON (((l.classoid = rel.tableoid) AND (l.objoid = rel.oid))))
JOIN pg_attribute att ON (((rel.oid = att.attrelid) AND (l.objsubid = att.attnum)))) JOIN pg_attribute att ON (((rel.oid = att.attrelid) AND (l.objsubid = att.attnum))))
JOIN pg_namespace nsp ON ((rel.relnamespace = nsp.oid))) JOIN pg_namespace nsp ON ((rel.relnamespace = nsp.oid)))
WHERE (l.objsubid <> 0)) WHERE (l.objsubid <> 0))
UNION ALL UNION ALL
SELECT l.objoid, SELECT l.objoid,
l.classoid, l.classoid,
l.objsubid, l.objsubid,
CASE CASE
WHEN (pro.proisagg = true) THEN 'aggregate'::text WHEN (pro.proisagg = true) THEN 'aggregate'::text
WHEN (pro.proisagg = false) THEN 'function'::text WHEN (pro.proisagg = false) THEN 'function'::text
ELSE NULL::text ELSE NULL::text
END AS objtype, END AS objtype,
pro.pronamespace AS objnamespace, pro.pronamespace AS objnamespace,
((( (((
CASE CASE
WHEN pg_function_is_visible(pro.oid) THEN quote_ident((pro.proname)::text) WHEN pg_function_is_visible(pro.oid) THEN quote_ident((pro.proname)::text)
ELSE ((quote_ident((nsp.nspname)::text) || '.'::text) || quote_ident((pro.proname)::text)) ELSE ((quote_ident((nsp.nspname)::text) || '.'::text) || quote_ident((pro.proname)::text))
END || '('::text) || pg_get_function_arguments(pro.oid)) || ')'::text) AS objname, END || '('::text) || pg_get_function_arguments(pro.oid)) || ')'::text) AS objname,
l.provider, l.provider,
l.label l.label
FROM ((pg_seclabel l FROM ((pg_seclabel l
JOIN pg_proc pro ON (((l.classoid = pro.tableoid) AND (l.objoid = pro.oid)))) JOIN pg_proc pro ON (((l.classoid = pro.tableoid) AND (l.objoid = pro.oid))))
JOIN pg_namespace nsp ON ((pro.pronamespace = nsp.oid))) JOIN pg_namespace nsp ON ((pro.pronamespace = nsp.oid)))
WHERE (l.objsubid = 0)) WHERE (l.objsubid = 0))
UNION ALL UNION ALL
SELECT l.objoid, SELECT l.objoid,
l.classoid, l.classoid,
l.objsubid, l.objsubid,
CASE CASE
WHEN (typ.typtype = 'd'::"char") THEN 'domain'::text WHEN (typ.typtype = 'd'::"char") THEN 'domain'::text
ELSE 'type'::text ELSE 'type'::text
END AS objtype, END AS objtype,
typ.typnamespace AS objnamespace, typ.typnamespace AS objnamespace,
CASE CASE
WHEN pg_type_is_visible(typ.oid) THEN quote_ident((typ.typname)::text) WHEN pg_type_is_visible(typ.oid) THEN quote_ident((typ.typname)::text)
ELSE ((quote_ident((nsp.nspname)::text) || '.'::text) || quote_ident((typ.typname)::text)) ELSE ((quote_ident((nsp.nspname)::text) || '.'::text) || quote_ident((typ.typname)::text))
END AS objname, END AS objname,
l.provider, l.provider,
l.label l.label
FROM ((pg_seclabel l FROM ((pg_seclabel l
JOIN pg_type typ ON (((l.classoid = typ.tableoid) AND (l.objoid = typ.oid)))) JOIN pg_type typ ON (((l.classoid = typ.tableoid) AND (l.objoid = typ.oid))))
JOIN pg_namespace nsp ON ((typ.typnamespace = nsp.oid))) JOIN pg_namespace nsp ON ((typ.typnamespace = nsp.oid)))
WHERE (l.objsubid = 0)) WHERE (l.objsubid = 0))
UNION ALL UNION ALL
SELECT l.objoid, SELECT l.objoid,
l.classoid, l.classoid,
l.objsubid, l.objsubid,
'large object'::text AS objtype, 'large object'::text AS objtype,
NULL::oid AS objnamespace, NULL::oid AS objnamespace,
(l.objoid)::text AS objname, (l.objoid)::text AS objname,
l.provider, l.provider,
l.label l.label
FROM (pg_seclabel l FROM (pg_seclabel l
JOIN pg_largeobject_metadata lom ON ((l.objoid = lom.oid))) JOIN pg_largeobject_metadata lom ON ((l.objoid = lom.oid)))
WHERE ((l.classoid = ('pg_largeobject'::regclass)::oid) AND (l.objsubid = 0))) WHERE ((l.classoid = ('pg_largeobject'::regclass)::oid) AND (l.objsubid = 0)))
UNION ALL UNION ALL
SELECT l.objoid, SELECT l.objoid,
l.classoid, l.classoid,
l.objsubid, l.objsubid,
'language'::text AS objtype, 'language'::text AS objtype,
NULL::oid AS objnamespace, NULL::oid AS objnamespace,
quote_ident((lan.lanname)::text) AS objname, quote_ident((lan.lanname)::text) AS objname,
l.provider, l.provider,
l.label l.label
FROM (pg_seclabel l FROM (pg_seclabel l
JOIN pg_language lan ON (((l.classoid = lan.tableoid) AND (l.objoid = lan.oid)))) JOIN pg_language lan ON (((l.classoid = lan.tableoid) AND (l.objoid = lan.oid))))
WHERE (l.objsubid = 0)) WHERE (l.objsubid = 0))
UNION ALL UNION ALL
SELECT l.objoid, SELECT l.objoid,
l.classoid, l.classoid,
l.objsubid, l.objsubid,
'schema'::text AS objtype, 'schema'::text AS objtype,
nsp.oid AS objnamespace, nsp.oid AS objnamespace,
quote_ident((nsp.nspname)::text) AS objname, quote_ident((nsp.nspname)::text) AS objname,
l.provider, l.provider,
l.label l.label
FROM (pg_seclabel l FROM (pg_seclabel l
JOIN pg_namespace nsp ON (((l.classoid = nsp.tableoid) AND (l.objoid = nsp.oid)))) JOIN pg_namespace nsp ON (((l.classoid = nsp.tableoid) AND (l.objoid = nsp.oid))))
WHERE (l.objsubid = 0)) WHERE (l.objsubid = 0))
UNION ALL UNION ALL
SELECT l.objoid, SELECT l.objoid,
l.classoid, l.classoid,
l.objsubid, l.objsubid,
'event trigger'::text AS objtype, 'event trigger'::text AS objtype,
NULL::oid AS objnamespace, NULL::oid AS objnamespace,
quote_ident((evt.evtname)::text) AS objname, quote_ident((evt.evtname)::text) AS objname,
l.provider, l.provider,
l.label l.label
FROM (pg_seclabel l FROM (pg_seclabel l
JOIN pg_event_trigger evt ON (((l.classoid = evt.tableoid) AND (l.objoid = evt.oid)))) JOIN pg_event_trigger evt ON (((l.classoid = evt.tableoid) AND (l.objoid = evt.oid))))
WHERE (l.objsubid = 0)) WHERE (l.objsubid = 0))
UNION ALL UNION ALL
SELECT l.objoid, SELECT l.objoid,
l.classoid, l.classoid,
0 AS objsubid, 0 AS objsubid,
'database'::text AS objtype, 'database'::text AS objtype,
NULL::oid AS objnamespace, NULL::oid AS objnamespace,
quote_ident((dat.datname)::text) AS objname, quote_ident((dat.datname)::text) AS objname,
l.provider, l.provider,
l.label l.label
FROM (pg_shseclabel l FROM (pg_shseclabel l
JOIN pg_database dat ON (((l.classoid = dat.tableoid) AND (l.objoid = dat.oid))))) JOIN pg_database dat ON (((l.classoid = dat.tableoid) AND (l.objoid = dat.oid)))))
UNION ALL UNION ALL
SELECT l.objoid, SELECT l.objoid,
l.classoid, l.classoid,
0 AS objsubid, 0 AS objsubid,
'tablespace'::text AS objtype, 'tablespace'::text AS objtype,
NULL::oid AS objnamespace, NULL::oid AS objnamespace,
quote_ident((spc.spcname)::text) AS objname, quote_ident((spc.spcname)::text) AS objname,
l.provider, l.provider,
l.label l.label
FROM (pg_shseclabel l FROM (pg_shseclabel l
JOIN pg_tablespace spc ON (((l.classoid = spc.tableoid) AND (l.objoid = spc.oid))))) JOIN pg_tablespace spc ON (((l.classoid = spc.tableoid) AND (l.objoid = spc.oid)))))
UNION ALL UNION ALL
SELECT l.objoid, SELECT l.objoid,
l.classoid, l.classoid,
0 AS objsubid, 0 AS objsubid,
'role'::text AS objtype, 'role'::text AS objtype,
NULL::oid AS objnamespace, NULL::oid AS objnamespace,
quote_ident((rol.rolname)::text) AS objname, quote_ident((rol.rolname)::text) AS objname,
l.provider, l.provider,
l.label l.label
FROM (pg_shseclabel l FROM (pg_shseclabel l
JOIN pg_authid rol ON (((l.classoid = rol.tableoid) AND (l.objoid = rol.oid)))); JOIN pg_authid rol ON (((l.classoid = rol.tableoid) AND (l.objoid = rol.oid))));
pg_settings| SELECT a.name, pg_settings| SELECT a.name,
a.setting, a.setting,
a.unit, a.unit,
a.category, a.category,
a.short_desc, a.short_desc,
a.extra_desc, a.extra_desc,
a.context, a.context,
a.vartype, a.vartype,
a.source, a.source,
a.min_val, a.min_val,
a.max_val, a.max_val,
a.enumvals, a.enumvals,
a.boot_val, a.boot_val,
a.reset_val, a.reset_val,
a.sourcefile, a.sourcefile,
a.sourceline a.sourceline
FROM pg_show_all_settings() a(name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, sourcefile, sourceline); FROM pg_show_all_settings() a(name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, sourcefile, sourceline);
pg_shadow| SELECT pg_authid.rolname AS usename, pg_shadow| SELECT pg_authid.rolname AS usename,
pg_authid.oid AS usesysid, pg_authid.oid AS usesysid,
pg_authid.rolcreatedb AS usecreatedb, pg_authid.rolcreatedb AS usecreatedb,
pg_authid.rolsuper AS usesuper, pg_authid.rolsuper AS usesuper,
pg_authid.rolcatupdate AS usecatupd, pg_authid.rolcatupdate AS usecatupd,
pg_authid.rolreplication AS userepl, pg_authid.rolreplication AS userepl,
pg_authid.rolpassword AS passwd, pg_authid.rolpassword AS passwd,
(pg_authid.rolvaliduntil)::abstime AS valuntil, (pg_authid.rolvaliduntil)::abstime AS valuntil,
s.setconfig AS useconfig s.setconfig AS useconfig
FROM (pg_authid FROM (pg_authid
LEFT JOIN pg_db_role_setting s ON (((pg_authid.oid = s.setrole) AND (s.setdatabase = (0)::oid)))) LEFT JOIN pg_db_role_setting s ON (((pg_authid.oid = s.setrole) AND (s.setdatabase = (0)::oid))))
WHERE pg_authid.rolcanlogin; WHERE pg_authid.rolcanlogin;
pg_stat_activity| SELECT s.datid, pg_stat_activity| SELECT s.datid,
d.datname, d.datname,
s.pid, s.pid,
s.usesysid, s.usesysid,
u.rolname AS usename, u.rolname AS usename,
s.application_name, s.application_name,
s.client_addr, s.client_addr,
s.client_hostname, s.client_hostname,
s.client_port, s.client_port,
s.backend_start, s.backend_start,
s.xact_start, s.xact_start,
s.query_start, s.query_start,
s.state_change, s.state_change,
s.waiting, s.waiting,
s.state, s.state,
s.query s.query
FROM pg_database d, FROM pg_database d,
pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, waiting, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port), pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, waiting, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port),
pg_authid u pg_authid u
WHERE ((s.datid = d.oid) AND (s.usesysid = u.oid)); WHERE ((s.datid = d.oid) AND (s.usesysid = u.oid));
pg_stat_all_indexes| SELECT c.oid AS relid, pg_stat_all_indexes| SELECT c.oid AS relid,
i.oid AS indexrelid, i.oid AS indexrelid,
n.nspname AS schemaname, n.nspname AS schemaname,
c.relname, c.relname,
i.relname AS indexrelname, i.relname AS indexrelname,
pg_stat_get_numscans(i.oid) AS idx_scan, pg_stat_get_numscans(i.oid) AS idx_scan,
pg_stat_get_tuples_returned(i.oid) AS idx_tup_read, pg_stat_get_tuples_returned(i.oid) AS idx_tup_read,
pg_stat_get_tuples_fetched(i.oid) AS idx_tup_fetch pg_stat_get_tuples_fetched(i.oid) AS idx_tup_fetch
FROM (((pg_class c FROM (((pg_class c
JOIN pg_index x ON ((c.oid = x.indrelid))) JOIN pg_index x ON ((c.oid = x.indrelid)))
JOIN pg_class i ON ((i.oid = x.indexrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"])); WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"]));
pg_stat_all_tables| SELECT c.oid AS relid, pg_stat_all_tables| SELECT c.oid AS relid,
n.nspname AS schemaname, n.nspname AS schemaname,
c.relname, c.relname,
pg_stat_get_numscans(c.oid) AS seq_scan, pg_stat_get_numscans(c.oid) AS seq_scan,
pg_stat_get_tuples_returned(c.oid) AS seq_tup_read, pg_stat_get_tuples_returned(c.oid) AS seq_tup_read,
(sum(pg_stat_get_numscans(i.indexrelid)))::bigint AS idx_scan, (sum(pg_stat_get_numscans(i.indexrelid)))::bigint AS idx_scan,
((sum(pg_stat_get_tuples_fetched(i.indexrelid)))::bigint + pg_stat_get_tuples_fetched(c.oid)) AS idx_tup_fetch, ((sum(pg_stat_get_tuples_fetched(i.indexrelid)))::bigint + pg_stat_get_tuples_fetched(c.oid)) AS idx_tup_fetch,
pg_stat_get_tuples_inserted(c.oid) AS n_tup_ins, pg_stat_get_tuples_inserted(c.oid) AS n_tup_ins,
pg_stat_get_tuples_updated(c.oid) AS n_tup_upd, pg_stat_get_tuples_updated(c.oid) AS n_tup_upd,
pg_stat_get_tuples_deleted(c.oid) AS n_tup_del, pg_stat_get_tuples_deleted(c.oid) AS n_tup_del,
pg_stat_get_tuples_hot_updated(c.oid) AS n_tup_hot_upd, pg_stat_get_tuples_hot_updated(c.oid) AS n_tup_hot_upd,
pg_stat_get_live_tuples(c.oid) AS n_live_tup, pg_stat_get_live_tuples(c.oid) AS n_live_tup,
pg_stat_get_dead_tuples(c.oid) AS n_dead_tup, pg_stat_get_dead_tuples(c.oid) AS n_dead_tup,
pg_stat_get_mod_since_analyze(c.oid) AS n_mod_since_analyze, pg_stat_get_mod_since_analyze(c.oid) AS n_mod_since_analyze,
pg_stat_get_last_vacuum_time(c.oid) AS last_vacuum, pg_stat_get_last_vacuum_time(c.oid) AS last_vacuum,
pg_stat_get_last_autovacuum_time(c.oid) AS last_autovacuum, pg_stat_get_last_autovacuum_time(c.oid) AS last_autovacuum,
pg_stat_get_last_analyze_time(c.oid) AS last_analyze, pg_stat_get_last_analyze_time(c.oid) AS last_analyze,
pg_stat_get_last_autoanalyze_time(c.oid) AS last_autoanalyze, pg_stat_get_last_autoanalyze_time(c.oid) AS last_autoanalyze,
pg_stat_get_vacuum_count(c.oid) AS vacuum_count, pg_stat_get_vacuum_count(c.oid) AS vacuum_count,
pg_stat_get_autovacuum_count(c.oid) AS autovacuum_count, pg_stat_get_autovacuum_count(c.oid) AS autovacuum_count,
pg_stat_get_analyze_count(c.oid) AS analyze_count, pg_stat_get_analyze_count(c.oid) AS analyze_count,
pg_stat_get_autoanalyze_count(c.oid) AS autoanalyze_count pg_stat_get_autoanalyze_count(c.oid) AS autoanalyze_count
FROM ((pg_class c FROM ((pg_class c
LEFT JOIN pg_index i ON ((c.oid = i.indrelid))) LEFT JOIN pg_index i ON ((c.oid = i.indrelid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"])) WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"]))
GROUP BY c.oid, n.nspname, c.relname; GROUP BY c.oid, n.nspname, c.relname;
pg_stat_bgwriter| SELECT pg_stat_get_bgwriter_timed_checkpoints() AS checkpoints_timed, pg_stat_bgwriter| SELECT pg_stat_get_bgwriter_timed_checkpoints() AS checkpoints_timed,
pg_stat_get_bgwriter_requested_checkpoints() AS checkpoints_req, pg_stat_get_bgwriter_requested_checkpoints() AS checkpoints_req,
pg_stat_get_checkpoint_write_time() AS checkpoint_write_time, pg_stat_get_checkpoint_write_time() AS checkpoint_write_time,
pg_stat_get_checkpoint_sync_time() AS checkpoint_sync_time, pg_stat_get_checkpoint_sync_time() AS checkpoint_sync_time,
pg_stat_get_bgwriter_buf_written_checkpoints() AS buffers_checkpoint, pg_stat_get_bgwriter_buf_written_checkpoints() AS buffers_checkpoint,
pg_stat_get_bgwriter_buf_written_clean() AS buffers_clean, pg_stat_get_bgwriter_buf_written_clean() AS buffers_clean,
pg_stat_get_bgwriter_maxwritten_clean() AS maxwritten_clean, pg_stat_get_bgwriter_maxwritten_clean() AS maxwritten_clean,
pg_stat_get_buf_written_backend() AS buffers_backend, pg_stat_get_buf_written_backend() AS buffers_backend,
pg_stat_get_buf_fsync_backend() AS buffers_backend_fsync, pg_stat_get_buf_fsync_backend() AS buffers_backend_fsync,
pg_stat_get_buf_alloc() AS buffers_alloc, pg_stat_get_buf_alloc() AS buffers_alloc,
pg_stat_get_bgwriter_stat_reset_time() AS stats_reset; pg_stat_get_bgwriter_stat_reset_time() AS stats_reset;
pg_stat_database| SELECT d.oid AS datid, pg_stat_database| SELECT d.oid AS datid,
d.datname, d.datname,
pg_stat_get_db_numbackends(d.oid) AS numbackends, pg_stat_get_db_numbackends(d.oid) AS numbackends,
pg_stat_get_db_xact_commit(d.oid) AS xact_commit, pg_stat_get_db_xact_commit(d.oid) AS xact_commit,
pg_stat_get_db_xact_rollback(d.oid) AS xact_rollback, pg_stat_get_db_xact_rollback(d.oid) AS xact_rollback,
(pg_stat_get_db_blocks_fetched(d.oid) - pg_stat_get_db_blocks_hit(d.oid)) AS blks_read, (pg_stat_get_db_blocks_fetched(d.oid) - pg_stat_get_db_blocks_hit(d.oid)) AS blks_read,
pg_stat_get_db_blocks_hit(d.oid) AS blks_hit, pg_stat_get_db_blocks_hit(d.oid) AS blks_hit,
pg_stat_get_db_tuples_returned(d.oid) AS tup_returned, pg_stat_get_db_tuples_returned(d.oid) AS tup_returned,
pg_stat_get_db_tuples_fetched(d.oid) AS tup_fetched, pg_stat_get_db_tuples_fetched(d.oid) AS tup_fetched,
pg_stat_get_db_tuples_inserted(d.oid) AS tup_inserted, pg_stat_get_db_tuples_inserted(d.oid) AS tup_inserted,
pg_stat_get_db_tuples_updated(d.oid) AS tup_updated, pg_stat_get_db_tuples_updated(d.oid) AS tup_updated,
pg_stat_get_db_tuples_deleted(d.oid) AS tup_deleted, pg_stat_get_db_tuples_deleted(d.oid) AS tup_deleted,
pg_stat_get_db_conflict_all(d.oid) AS conflicts, pg_stat_get_db_conflict_all(d.oid) AS conflicts,
pg_stat_get_db_temp_files(d.oid) AS temp_files, pg_stat_get_db_temp_files(d.oid) AS temp_files,
pg_stat_get_db_temp_bytes(d.oid) AS temp_bytes, pg_stat_get_db_temp_bytes(d.oid) AS temp_bytes,
pg_stat_get_db_deadlocks(d.oid) AS deadlocks, pg_stat_get_db_deadlocks(d.oid) AS deadlocks,
pg_stat_get_db_blk_read_time(d.oid) AS blk_read_time, pg_stat_get_db_blk_read_time(d.oid) AS blk_read_time,
pg_stat_get_db_blk_write_time(d.oid) AS blk_write_time, pg_stat_get_db_blk_write_time(d.oid) AS blk_write_time,
pg_stat_get_db_stat_reset_time(d.oid) AS stats_reset pg_stat_get_db_stat_reset_time(d.oid) AS stats_reset
FROM pg_database d; FROM pg_database d;
pg_stat_database_conflicts| SELECT d.oid AS datid, pg_stat_database_conflicts| SELECT d.oid AS datid,
d.datname, d.datname,
pg_stat_get_db_conflict_tablespace(d.oid) AS confl_tablespace, pg_stat_get_db_conflict_tablespace(d.oid) AS confl_tablespace,
pg_stat_get_db_conflict_lock(d.oid) AS confl_lock, pg_stat_get_db_conflict_lock(d.oid) AS confl_lock,
pg_stat_get_db_conflict_snapshot(d.oid) AS confl_snapshot, pg_stat_get_db_conflict_snapshot(d.oid) AS confl_snapshot,
pg_stat_get_db_conflict_bufferpin(d.oid) AS confl_bufferpin, pg_stat_get_db_conflict_bufferpin(d.oid) AS confl_bufferpin,
pg_stat_get_db_conflict_startup_deadlock(d.oid) AS confl_deadlock pg_stat_get_db_conflict_startup_deadlock(d.oid) AS confl_deadlock
FROM pg_database d; FROM pg_database d;
pg_stat_replication| SELECT s.pid, pg_stat_replication| SELECT s.pid,
s.usesysid, s.usesysid,
u.rolname AS usename, u.rolname AS usename,
s.application_name, s.application_name,
s.client_addr, s.client_addr,
s.client_hostname, s.client_hostname,
s.client_port, s.client_port,
s.backend_start, s.backend_start,
w.state, w.state,
w.sent_location, w.sent_location,
w.write_location, w.write_location,
w.flush_location, w.flush_location,
w.replay_location, w.replay_location,
w.sync_priority, w.sync_priority,
w.sync_state w.sync_state
FROM pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, waiting, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port), FROM pg_stat_get_activity(NULL::integer) s(datid, pid, usesysid, application_name, state, query, waiting, xact_start, query_start, backend_start, state_change, client_addr, client_hostname, client_port),
pg_authid u, pg_authid u,
pg_stat_get_wal_senders() w(pid, state, sent_location, write_location, flush_location, replay_location, sync_priority, sync_state) pg_stat_get_wal_senders() w(pid, state, sent_location, write_location, flush_location, replay_location, sync_priority, sync_state)
WHERE ((s.usesysid = u.oid) AND (s.pid = w.pid)); WHERE ((s.usesysid = u.oid) AND (s.pid = w.pid));
pg_stat_sys_indexes| SELECT pg_stat_all_indexes.relid, pg_stat_sys_indexes| SELECT pg_stat_all_indexes.relid,
pg_stat_all_indexes.indexrelid, pg_stat_all_indexes.indexrelid,
pg_stat_all_indexes.schemaname, pg_stat_all_indexes.schemaname,
pg_stat_all_indexes.relname, pg_stat_all_indexes.relname,
pg_stat_all_indexes.indexrelname, pg_stat_all_indexes.indexrelname,
pg_stat_all_indexes.idx_scan, pg_stat_all_indexes.idx_scan,
pg_stat_all_indexes.idx_tup_read, pg_stat_all_indexes.idx_tup_read,
pg_stat_all_indexes.idx_tup_fetch pg_stat_all_indexes.idx_tup_fetch
FROM pg_stat_all_indexes FROM pg_stat_all_indexes
WHERE ((pg_stat_all_indexes.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_stat_all_indexes.schemaname ~ '^pg_toast'::text)); WHERE ((pg_stat_all_indexes.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_stat_all_indexes.schemaname ~ '^pg_toast'::text));
pg_stat_sys_tables| SELECT pg_stat_all_tables.relid, pg_stat_sys_tables| SELECT pg_stat_all_tables.relid,
pg_stat_all_tables.schemaname, pg_stat_all_tables.schemaname,
pg_stat_all_tables.relname, pg_stat_all_tables.relname,
pg_stat_all_tables.seq_scan, pg_stat_all_tables.seq_scan,
pg_stat_all_tables.seq_tup_read, pg_stat_all_tables.seq_tup_read,
pg_stat_all_tables.idx_scan, pg_stat_all_tables.idx_scan,
pg_stat_all_tables.idx_tup_fetch, pg_stat_all_tables.idx_tup_fetch,
pg_stat_all_tables.n_tup_ins, pg_stat_all_tables.n_tup_ins,
pg_stat_all_tables.n_tup_upd, pg_stat_all_tables.n_tup_upd,
pg_stat_all_tables.n_tup_del, pg_stat_all_tables.n_tup_del,
pg_stat_all_tables.n_tup_hot_upd, pg_stat_all_tables.n_tup_hot_upd,
pg_stat_all_tables.n_live_tup, pg_stat_all_tables.n_live_tup,
pg_stat_all_tables.n_dead_tup, pg_stat_all_tables.n_dead_tup,
pg_stat_all_tables.n_mod_since_analyze, pg_stat_all_tables.n_mod_since_analyze,
pg_stat_all_tables.last_vacuum, pg_stat_all_tables.last_vacuum,
pg_stat_all_tables.last_autovacuum, pg_stat_all_tables.last_autovacuum,
pg_stat_all_tables.last_analyze, pg_stat_all_tables.last_analyze,
pg_stat_all_tables.last_autoanalyze, pg_stat_all_tables.last_autoanalyze,
pg_stat_all_tables.vacuum_count, pg_stat_all_tables.vacuum_count,
pg_stat_all_tables.autovacuum_count, pg_stat_all_tables.autovacuum_count,
pg_stat_all_tables.analyze_count, pg_stat_all_tables.analyze_count,
pg_stat_all_tables.autoanalyze_count pg_stat_all_tables.autoanalyze_count
FROM pg_stat_all_tables FROM pg_stat_all_tables
WHERE ((pg_stat_all_tables.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_stat_all_tables.schemaname ~ '^pg_toast'::text)); WHERE ((pg_stat_all_tables.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_stat_all_tables.schemaname ~ '^pg_toast'::text));
pg_stat_user_functions| SELECT p.oid AS funcid, pg_stat_user_functions| SELECT p.oid AS funcid,
n.nspname AS schemaname, n.nspname AS schemaname,
p.proname AS funcname, p.proname AS funcname,
pg_stat_get_function_calls(p.oid) AS calls, pg_stat_get_function_calls(p.oid) AS calls,
pg_stat_get_function_total_time(p.oid) AS total_time, pg_stat_get_function_total_time(p.oid) AS total_time,
pg_stat_get_function_self_time(p.oid) AS self_time pg_stat_get_function_self_time(p.oid) AS self_time
FROM (pg_proc p FROM (pg_proc p
LEFT JOIN pg_namespace n ON ((n.oid = p.pronamespace))) LEFT JOIN pg_namespace n ON ((n.oid = p.pronamespace)))
WHERE ((p.prolang <> (12)::oid) AND (pg_stat_get_function_calls(p.oid) IS NOT NULL)); WHERE ((p.prolang <> (12)::oid) AND (pg_stat_get_function_calls(p.oid) IS NOT NULL));
pg_stat_user_indexes| SELECT pg_stat_all_indexes.relid, pg_stat_user_indexes| SELECT pg_stat_all_indexes.relid,
pg_stat_all_indexes.indexrelid, pg_stat_all_indexes.indexrelid,
pg_stat_all_indexes.schemaname, pg_stat_all_indexes.schemaname,
pg_stat_all_indexes.relname, pg_stat_all_indexes.relname,
pg_stat_all_indexes.indexrelname, pg_stat_all_indexes.indexrelname,
pg_stat_all_indexes.idx_scan, pg_stat_all_indexes.idx_scan,
pg_stat_all_indexes.idx_tup_read, pg_stat_all_indexes.idx_tup_read,
pg_stat_all_indexes.idx_tup_fetch pg_stat_all_indexes.idx_tup_fetch
FROM pg_stat_all_indexes FROM pg_stat_all_indexes
WHERE ((pg_stat_all_indexes.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_stat_all_indexes.schemaname !~ '^pg_toast'::text)); WHERE ((pg_stat_all_indexes.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_stat_all_indexes.schemaname !~ '^pg_toast'::text));
pg_stat_user_tables| SELECT pg_stat_all_tables.relid, pg_stat_user_tables| SELECT pg_stat_all_tables.relid,
pg_stat_all_tables.schemaname, pg_stat_all_tables.schemaname,
pg_stat_all_tables.relname, pg_stat_all_tables.relname,
pg_stat_all_tables.seq_scan, pg_stat_all_tables.seq_scan,
pg_stat_all_tables.seq_tup_read, pg_stat_all_tables.seq_tup_read,
pg_stat_all_tables.idx_scan, pg_stat_all_tables.idx_scan,
pg_stat_all_tables.idx_tup_fetch, pg_stat_all_tables.idx_tup_fetch,
pg_stat_all_tables.n_tup_ins, pg_stat_all_tables.n_tup_ins,
pg_stat_all_tables.n_tup_upd, pg_stat_all_tables.n_tup_upd,
pg_stat_all_tables.n_tup_del, pg_stat_all_tables.n_tup_del,
pg_stat_all_tables.n_tup_hot_upd, pg_stat_all_tables.n_tup_hot_upd,
pg_stat_all_tables.n_live_tup, pg_stat_all_tables.n_live_tup,
pg_stat_all_tables.n_dead_tup, pg_stat_all_tables.n_dead_tup,
pg_stat_all_tables.n_mod_since_analyze, pg_stat_all_tables.n_mod_since_analyze,
pg_stat_all_tables.last_vacuum, pg_stat_all_tables.last_vacuum,
pg_stat_all_tables.last_autovacuum, pg_stat_all_tables.last_autovacuum,
pg_stat_all_tables.last_analyze, pg_stat_all_tables.last_analyze,
pg_stat_all_tables.last_autoanalyze, pg_stat_all_tables.last_autoanalyze,
pg_stat_all_tables.vacuum_count, pg_stat_all_tables.vacuum_count,
pg_stat_all_tables.autovacuum_count, pg_stat_all_tables.autovacuum_count,
pg_stat_all_tables.analyze_count, pg_stat_all_tables.analyze_count,
pg_stat_all_tables.autoanalyze_count pg_stat_all_tables.autoanalyze_count
FROM pg_stat_all_tables FROM pg_stat_all_tables
WHERE ((pg_stat_all_tables.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_stat_all_tables.schemaname !~ '^pg_toast'::text)); WHERE ((pg_stat_all_tables.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_stat_all_tables.schemaname !~ '^pg_toast'::text));
pg_stat_xact_all_tables| SELECT c.oid AS relid, pg_stat_xact_all_tables| SELECT c.oid AS relid,
n.nspname AS schemaname, n.nspname AS schemaname,
c.relname, c.relname,
pg_stat_get_xact_numscans(c.oid) AS seq_scan, pg_stat_get_xact_numscans(c.oid) AS seq_scan,
pg_stat_get_xact_tuples_returned(c.oid) AS seq_tup_read, pg_stat_get_xact_tuples_returned(c.oid) AS seq_tup_read,
(sum(pg_stat_get_xact_numscans(i.indexrelid)))::bigint AS idx_scan, (sum(pg_stat_get_xact_numscans(i.indexrelid)))::bigint AS idx_scan,
((sum(pg_stat_get_xact_tuples_fetched(i.indexrelid)))::bigint + pg_stat_get_xact_tuples_fetched(c.oid)) AS idx_tup_fetch, ((sum(pg_stat_get_xact_tuples_fetched(i.indexrelid)))::bigint + pg_stat_get_xact_tuples_fetched(c.oid)) AS idx_tup_fetch,
pg_stat_get_xact_tuples_inserted(c.oid) AS n_tup_ins, pg_stat_get_xact_tuples_inserted(c.oid) AS n_tup_ins,
pg_stat_get_xact_tuples_updated(c.oid) AS n_tup_upd, pg_stat_get_xact_tuples_updated(c.oid) AS n_tup_upd,
pg_stat_get_xact_tuples_deleted(c.oid) AS n_tup_del, pg_stat_get_xact_tuples_deleted(c.oid) AS n_tup_del,
pg_stat_get_xact_tuples_hot_updated(c.oid) AS n_tup_hot_upd pg_stat_get_xact_tuples_hot_updated(c.oid) AS n_tup_hot_upd
FROM ((pg_class c FROM ((pg_class c
LEFT JOIN pg_index i ON ((c.oid = i.indrelid))) LEFT JOIN pg_index i ON ((c.oid = i.indrelid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"])) WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"]))
GROUP BY c.oid, n.nspname, c.relname; GROUP BY c.oid, n.nspname, c.relname;
pg_stat_xact_sys_tables| SELECT pg_stat_xact_all_tables.relid, pg_stat_xact_sys_tables| SELECT pg_stat_xact_all_tables.relid,
pg_stat_xact_all_tables.schemaname, pg_stat_xact_all_tables.schemaname,
pg_stat_xact_all_tables.relname, pg_stat_xact_all_tables.relname,
pg_stat_xact_all_tables.seq_scan, pg_stat_xact_all_tables.seq_scan,
pg_stat_xact_all_tables.seq_tup_read, pg_stat_xact_all_tables.seq_tup_read,
pg_stat_xact_all_tables.idx_scan, pg_stat_xact_all_tables.idx_scan,
pg_stat_xact_all_tables.idx_tup_fetch, pg_stat_xact_all_tables.idx_tup_fetch,
pg_stat_xact_all_tables.n_tup_ins, pg_stat_xact_all_tables.n_tup_ins,
pg_stat_xact_all_tables.n_tup_upd, pg_stat_xact_all_tables.n_tup_upd,
pg_stat_xact_all_tables.n_tup_del, pg_stat_xact_all_tables.n_tup_del,
pg_stat_xact_all_tables.n_tup_hot_upd pg_stat_xact_all_tables.n_tup_hot_upd
FROM pg_stat_xact_all_tables FROM pg_stat_xact_all_tables
WHERE ((pg_stat_xact_all_tables.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_stat_xact_all_tables.schemaname ~ '^pg_toast'::text)); WHERE ((pg_stat_xact_all_tables.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_stat_xact_all_tables.schemaname ~ '^pg_toast'::text));
pg_stat_xact_user_functions| SELECT p.oid AS funcid, pg_stat_xact_user_functions| SELECT p.oid AS funcid,
n.nspname AS schemaname, n.nspname AS schemaname,
p.proname AS funcname, p.proname AS funcname,
pg_stat_get_xact_function_calls(p.oid) AS calls, pg_stat_get_xact_function_calls(p.oid) AS calls,
pg_stat_get_xact_function_total_time(p.oid) AS total_time, pg_stat_get_xact_function_total_time(p.oid) AS total_time,
pg_stat_get_xact_function_self_time(p.oid) AS self_time pg_stat_get_xact_function_self_time(p.oid) AS self_time
FROM (pg_proc p FROM (pg_proc p
LEFT JOIN pg_namespace n ON ((n.oid = p.pronamespace))) LEFT JOIN pg_namespace n ON ((n.oid = p.pronamespace)))
WHERE ((p.prolang <> (12)::oid) AND (pg_stat_get_xact_function_calls(p.oid) IS NOT NULL)); WHERE ((p.prolang <> (12)::oid) AND (pg_stat_get_xact_function_calls(p.oid) IS NOT NULL));
pg_stat_xact_user_tables| SELECT pg_stat_xact_all_tables.relid, pg_stat_xact_user_tables| SELECT pg_stat_xact_all_tables.relid,
pg_stat_xact_all_tables.schemaname, pg_stat_xact_all_tables.schemaname,
pg_stat_xact_all_tables.relname, pg_stat_xact_all_tables.relname,
pg_stat_xact_all_tables.seq_scan, pg_stat_xact_all_tables.seq_scan,
pg_stat_xact_all_tables.seq_tup_read, pg_stat_xact_all_tables.seq_tup_read,
pg_stat_xact_all_tables.idx_scan, pg_stat_xact_all_tables.idx_scan,
pg_stat_xact_all_tables.idx_tup_fetch, pg_stat_xact_all_tables.idx_tup_fetch,
pg_stat_xact_all_tables.n_tup_ins, pg_stat_xact_all_tables.n_tup_ins,
pg_stat_xact_all_tables.n_tup_upd, pg_stat_xact_all_tables.n_tup_upd,
pg_stat_xact_all_tables.n_tup_del, pg_stat_xact_all_tables.n_tup_del,
pg_stat_xact_all_tables.n_tup_hot_upd pg_stat_xact_all_tables.n_tup_hot_upd
FROM pg_stat_xact_all_tables FROM pg_stat_xact_all_tables
WHERE ((pg_stat_xact_all_tables.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_stat_xact_all_tables.schemaname !~ '^pg_toast'::text)); WHERE ((pg_stat_xact_all_tables.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_stat_xact_all_tables.schemaname !~ '^pg_toast'::text));
pg_statio_all_indexes| SELECT c.oid AS relid, pg_statio_all_indexes| SELECT c.oid AS relid,
i.oid AS indexrelid, i.oid AS indexrelid,
n.nspname AS schemaname, n.nspname AS schemaname,
c.relname, c.relname,
i.relname AS indexrelname, i.relname AS indexrelname,
(pg_stat_get_blocks_fetched(i.oid) - pg_stat_get_blocks_hit(i.oid)) AS idx_blks_read, (pg_stat_get_blocks_fetched(i.oid) - pg_stat_get_blocks_hit(i.oid)) AS idx_blks_read,
pg_stat_get_blocks_hit(i.oid) AS idx_blks_hit pg_stat_get_blocks_hit(i.oid) AS idx_blks_hit
FROM (((pg_class c FROM (((pg_class c
JOIN pg_index x ON ((c.oid = x.indrelid))) JOIN pg_index x ON ((c.oid = x.indrelid)))
JOIN pg_class i ON ((i.oid = x.indexrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"])); WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"]));
pg_statio_all_sequences| SELECT c.oid AS relid, pg_statio_all_sequences| SELECT c.oid AS relid,
n.nspname AS schemaname, n.nspname AS schemaname,
c.relname, c.relname,
(pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid)) AS blks_read, (pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid)) AS blks_read,
pg_stat_get_blocks_hit(c.oid) AS blks_hit pg_stat_get_blocks_hit(c.oid) AS blks_hit
FROM (pg_class c FROM (pg_class c
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = 'S'::"char"); WHERE (c.relkind = 'S'::"char");
pg_statio_all_tables| SELECT c.oid AS relid, pg_statio_all_tables| SELECT c.oid AS relid,
n.nspname AS schemaname, n.nspname AS schemaname,
c.relname, c.relname,
(pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid)) AS heap_blks_read, (pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid)) AS heap_blks_read,
pg_stat_get_blocks_hit(c.oid) AS heap_blks_hit, pg_stat_get_blocks_hit(c.oid) AS heap_blks_hit,
(sum((pg_stat_get_blocks_fetched(i.indexrelid) - pg_stat_get_blocks_hit(i.indexrelid))))::bigint AS idx_blks_read, (sum((pg_stat_get_blocks_fetched(i.indexrelid) - pg_stat_get_blocks_hit(i.indexrelid))))::bigint AS idx_blks_read,
(sum(pg_stat_get_blocks_hit(i.indexrelid)))::bigint AS idx_blks_hit, (sum(pg_stat_get_blocks_hit(i.indexrelid)))::bigint AS idx_blks_hit,
(pg_stat_get_blocks_fetched(t.oid) - pg_stat_get_blocks_hit(t.oid)) AS toast_blks_read, (pg_stat_get_blocks_fetched(t.oid) - pg_stat_get_blocks_hit(t.oid)) AS toast_blks_read,
pg_stat_get_blocks_hit(t.oid) AS toast_blks_hit, pg_stat_get_blocks_hit(t.oid) AS toast_blks_hit,
(sum((pg_stat_get_blocks_fetched(x.indexrelid) - pg_stat_get_blocks_hit(x.indexrelid))))::bigint AS tidx_blks_read, (sum((pg_stat_get_blocks_fetched(x.indexrelid) - pg_stat_get_blocks_hit(x.indexrelid))))::bigint AS tidx_blks_read,
(sum(pg_stat_get_blocks_hit(x.indexrelid)))::bigint AS tidx_blks_hit (sum(pg_stat_get_blocks_hit(x.indexrelid)))::bigint AS tidx_blks_hit
FROM ((((pg_class c FROM ((((pg_class c
LEFT JOIN pg_index i ON ((c.oid = i.indrelid))) LEFT JOIN pg_index i ON ((c.oid = i.indrelid)))
...@@ -1864,71 +1864,71 @@ pg_statio_all_tables| SELECT c.oid AS relid, ...@@ -1864,71 +1864,71 @@ pg_statio_all_tables| SELECT c.oid AS relid,
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"])) WHERE (c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"]))
GROUP BY c.oid, n.nspname, c.relname, t.oid, x.indrelid; GROUP BY c.oid, n.nspname, c.relname, t.oid, x.indrelid;
pg_statio_sys_indexes| SELECT pg_statio_all_indexes.relid, pg_statio_sys_indexes| SELECT pg_statio_all_indexes.relid,
pg_statio_all_indexes.indexrelid, pg_statio_all_indexes.indexrelid,
pg_statio_all_indexes.schemaname, pg_statio_all_indexes.schemaname,
pg_statio_all_indexes.relname, pg_statio_all_indexes.relname,
pg_statio_all_indexes.indexrelname, pg_statio_all_indexes.indexrelname,
pg_statio_all_indexes.idx_blks_read, pg_statio_all_indexes.idx_blks_read,
pg_statio_all_indexes.idx_blks_hit pg_statio_all_indexes.idx_blks_hit
FROM pg_statio_all_indexes FROM pg_statio_all_indexes
WHERE ((pg_statio_all_indexes.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_statio_all_indexes.schemaname ~ '^pg_toast'::text)); WHERE ((pg_statio_all_indexes.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_statio_all_indexes.schemaname ~ '^pg_toast'::text));
pg_statio_sys_sequences| SELECT pg_statio_all_sequences.relid, pg_statio_sys_sequences| SELECT pg_statio_all_sequences.relid,
pg_statio_all_sequences.schemaname, pg_statio_all_sequences.schemaname,
pg_statio_all_sequences.relname, pg_statio_all_sequences.relname,
pg_statio_all_sequences.blks_read, pg_statio_all_sequences.blks_read,
pg_statio_all_sequences.blks_hit pg_statio_all_sequences.blks_hit
FROM pg_statio_all_sequences FROM pg_statio_all_sequences
WHERE ((pg_statio_all_sequences.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_statio_all_sequences.schemaname ~ '^pg_toast'::text)); WHERE ((pg_statio_all_sequences.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_statio_all_sequences.schemaname ~ '^pg_toast'::text));
pg_statio_sys_tables| SELECT pg_statio_all_tables.relid, pg_statio_sys_tables| SELECT pg_statio_all_tables.relid,
pg_statio_all_tables.schemaname, pg_statio_all_tables.schemaname,
pg_statio_all_tables.relname, pg_statio_all_tables.relname,
pg_statio_all_tables.heap_blks_read, pg_statio_all_tables.heap_blks_read,
pg_statio_all_tables.heap_blks_hit, pg_statio_all_tables.heap_blks_hit,
pg_statio_all_tables.idx_blks_read, pg_statio_all_tables.idx_blks_read,
pg_statio_all_tables.idx_blks_hit, pg_statio_all_tables.idx_blks_hit,
pg_statio_all_tables.toast_blks_read, pg_statio_all_tables.toast_blks_read,
pg_statio_all_tables.toast_blks_hit, pg_statio_all_tables.toast_blks_hit,
pg_statio_all_tables.tidx_blks_read, pg_statio_all_tables.tidx_blks_read,
pg_statio_all_tables.tidx_blks_hit pg_statio_all_tables.tidx_blks_hit
FROM pg_statio_all_tables FROM pg_statio_all_tables
WHERE ((pg_statio_all_tables.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_statio_all_tables.schemaname ~ '^pg_toast'::text)); WHERE ((pg_statio_all_tables.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_statio_all_tables.schemaname ~ '^pg_toast'::text));
pg_statio_user_indexes| SELECT pg_statio_all_indexes.relid, pg_statio_user_indexes| SELECT pg_statio_all_indexes.relid,
pg_statio_all_indexes.indexrelid, pg_statio_all_indexes.indexrelid,
pg_statio_all_indexes.schemaname, pg_statio_all_indexes.schemaname,
pg_statio_all_indexes.relname, pg_statio_all_indexes.relname,
pg_statio_all_indexes.indexrelname, pg_statio_all_indexes.indexrelname,
pg_statio_all_indexes.idx_blks_read, pg_statio_all_indexes.idx_blks_read,
pg_statio_all_indexes.idx_blks_hit pg_statio_all_indexes.idx_blks_hit
FROM pg_statio_all_indexes FROM pg_statio_all_indexes
WHERE ((pg_statio_all_indexes.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_statio_all_indexes.schemaname !~ '^pg_toast'::text)); WHERE ((pg_statio_all_indexes.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_statio_all_indexes.schemaname !~ '^pg_toast'::text));
pg_statio_user_sequences| SELECT pg_statio_all_sequences.relid, pg_statio_user_sequences| SELECT pg_statio_all_sequences.relid,
pg_statio_all_sequences.schemaname, pg_statio_all_sequences.schemaname,
pg_statio_all_sequences.relname, pg_statio_all_sequences.relname,
pg_statio_all_sequences.blks_read, pg_statio_all_sequences.blks_read,
pg_statio_all_sequences.blks_hit pg_statio_all_sequences.blks_hit
FROM pg_statio_all_sequences FROM pg_statio_all_sequences
WHERE ((pg_statio_all_sequences.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_statio_all_sequences.schemaname !~ '^pg_toast'::text)); WHERE ((pg_statio_all_sequences.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_statio_all_sequences.schemaname !~ '^pg_toast'::text));
pg_statio_user_tables| SELECT pg_statio_all_tables.relid, pg_statio_user_tables| SELECT pg_statio_all_tables.relid,
pg_statio_all_tables.schemaname, pg_statio_all_tables.schemaname,
pg_statio_all_tables.relname, pg_statio_all_tables.relname,
pg_statio_all_tables.heap_blks_read, pg_statio_all_tables.heap_blks_read,
pg_statio_all_tables.heap_blks_hit, pg_statio_all_tables.heap_blks_hit,
pg_statio_all_tables.idx_blks_read, pg_statio_all_tables.idx_blks_read,
pg_statio_all_tables.idx_blks_hit, pg_statio_all_tables.idx_blks_hit,
pg_statio_all_tables.toast_blks_read, pg_statio_all_tables.toast_blks_read,
pg_statio_all_tables.toast_blks_hit, pg_statio_all_tables.toast_blks_hit,
pg_statio_all_tables.tidx_blks_read, pg_statio_all_tables.tidx_blks_read,
pg_statio_all_tables.tidx_blks_hit pg_statio_all_tables.tidx_blks_hit
FROM pg_statio_all_tables FROM pg_statio_all_tables
WHERE ((pg_statio_all_tables.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_statio_all_tables.schemaname !~ '^pg_toast'::text)); WHERE ((pg_statio_all_tables.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_statio_all_tables.schemaname !~ '^pg_toast'::text));
pg_stats| SELECT n.nspname AS schemaname, pg_stats| SELECT n.nspname AS schemaname,
c.relname AS tablename, c.relname AS tablename,
a.attname, a.attname,
s.stainherit AS inherited, s.stainherit AS inherited,
s.stanullfrac AS null_frac, s.stanullfrac AS null_frac,
s.stawidth AS avg_width, s.stawidth AS avg_width,
s.stadistinct AS n_distinct, s.stadistinct AS n_distinct,
CASE CASE
WHEN (s.stakind1 = 1) THEN s.stavalues1 WHEN (s.stakind1 = 1) THEN s.stavalues1
WHEN (s.stakind2 = 1) THEN s.stavalues2 WHEN (s.stakind2 = 1) THEN s.stavalues2
...@@ -1936,7 +1936,7 @@ pg_stats| SELECT n.nspname AS schemaname, ...@@ -1936,7 +1936,7 @@ pg_stats| SELECT n.nspname AS schemaname,
WHEN (s.stakind4 = 1) THEN s.stavalues4 WHEN (s.stakind4 = 1) THEN s.stavalues4
WHEN (s.stakind5 = 1) THEN s.stavalues5 WHEN (s.stakind5 = 1) THEN s.stavalues5
ELSE NULL::anyarray ELSE NULL::anyarray
END AS most_common_vals, END AS most_common_vals,
CASE CASE
WHEN (s.stakind1 = 1) THEN s.stanumbers1 WHEN (s.stakind1 = 1) THEN s.stanumbers1
WHEN (s.stakind2 = 1) THEN s.stanumbers2 WHEN (s.stakind2 = 1) THEN s.stanumbers2
...@@ -1944,7 +1944,7 @@ pg_stats| SELECT n.nspname AS schemaname, ...@@ -1944,7 +1944,7 @@ pg_stats| SELECT n.nspname AS schemaname,
WHEN (s.stakind4 = 1) THEN s.stanumbers4 WHEN (s.stakind4 = 1) THEN s.stanumbers4
WHEN (s.stakind5 = 1) THEN s.stanumbers5 WHEN (s.stakind5 = 1) THEN s.stanumbers5
ELSE NULL::real[] ELSE NULL::real[]
END AS most_common_freqs, END AS most_common_freqs,
CASE CASE
WHEN (s.stakind1 = 2) THEN s.stavalues1 WHEN (s.stakind1 = 2) THEN s.stavalues1
WHEN (s.stakind2 = 2) THEN s.stavalues2 WHEN (s.stakind2 = 2) THEN s.stavalues2
...@@ -1952,7 +1952,7 @@ pg_stats| SELECT n.nspname AS schemaname, ...@@ -1952,7 +1952,7 @@ pg_stats| SELECT n.nspname AS schemaname,
WHEN (s.stakind4 = 2) THEN s.stavalues4 WHEN (s.stakind4 = 2) THEN s.stavalues4
WHEN (s.stakind5 = 2) THEN s.stavalues5 WHEN (s.stakind5 = 2) THEN s.stavalues5
ELSE NULL::anyarray ELSE NULL::anyarray
END AS histogram_bounds, END AS histogram_bounds,
CASE CASE
WHEN (s.stakind1 = 3) THEN s.stanumbers1[1] WHEN (s.stakind1 = 3) THEN s.stanumbers1[1]
WHEN (s.stakind2 = 3) THEN s.stanumbers2[1] WHEN (s.stakind2 = 3) THEN s.stanumbers2[1]
...@@ -1960,7 +1960,7 @@ pg_stats| SELECT n.nspname AS schemaname, ...@@ -1960,7 +1960,7 @@ pg_stats| SELECT n.nspname AS schemaname,
WHEN (s.stakind4 = 3) THEN s.stanumbers4[1] WHEN (s.stakind4 = 3) THEN s.stanumbers4[1]
WHEN (s.stakind5 = 3) THEN s.stanumbers5[1] WHEN (s.stakind5 = 3) THEN s.stanumbers5[1]
ELSE NULL::real ELSE NULL::real
END AS correlation, END AS correlation,
CASE CASE
WHEN (s.stakind1 = 4) THEN s.stavalues1 WHEN (s.stakind1 = 4) THEN s.stavalues1
WHEN (s.stakind2 = 4) THEN s.stavalues2 WHEN (s.stakind2 = 4) THEN s.stavalues2
...@@ -1968,7 +1968,7 @@ pg_stats| SELECT n.nspname AS schemaname, ...@@ -1968,7 +1968,7 @@ pg_stats| SELECT n.nspname AS schemaname,
WHEN (s.stakind4 = 4) THEN s.stavalues4 WHEN (s.stakind4 = 4) THEN s.stavalues4
WHEN (s.stakind5 = 4) THEN s.stavalues5 WHEN (s.stakind5 = 4) THEN s.stavalues5
ELSE NULL::anyarray ELSE NULL::anyarray
END AS most_common_elems, END AS most_common_elems,
CASE CASE
WHEN (s.stakind1 = 4) THEN s.stanumbers1 WHEN (s.stakind1 = 4) THEN s.stanumbers1
WHEN (s.stakind2 = 4) THEN s.stanumbers2 WHEN (s.stakind2 = 4) THEN s.stanumbers2
...@@ -1976,7 +1976,7 @@ pg_stats| SELECT n.nspname AS schemaname, ...@@ -1976,7 +1976,7 @@ pg_stats| SELECT n.nspname AS schemaname,
WHEN (s.stakind4 = 4) THEN s.stanumbers4 WHEN (s.stakind4 = 4) THEN s.stanumbers4
WHEN (s.stakind5 = 4) THEN s.stanumbers5 WHEN (s.stakind5 = 4) THEN s.stanumbers5
ELSE NULL::real[] ELSE NULL::real[]
END AS most_common_elem_freqs, END AS most_common_elem_freqs,
CASE CASE
WHEN (s.stakind1 = 5) THEN s.stanumbers1 WHEN (s.stakind1 = 5) THEN s.stanumbers1
WHEN (s.stakind2 = 5) THEN s.stanumbers2 WHEN (s.stakind2 = 5) THEN s.stanumbers2
...@@ -1990,44 +1990,44 @@ pg_stats| SELECT n.nspname AS schemaname, ...@@ -1990,44 +1990,44 @@ pg_stats| SELECT n.nspname AS schemaname,
JOIN pg_attribute a ON (((c.oid = a.attrelid) AND (a.attnum = s.staattnum)))) JOIN pg_attribute a ON (((c.oid = a.attrelid) AND (a.attnum = s.staattnum))))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE ((NOT a.attisdropped) AND has_column_privilege(c.oid, a.attnum, 'select'::text)); WHERE ((NOT a.attisdropped) AND has_column_privilege(c.oid, a.attnum, 'select'::text));
pg_tables| SELECT n.nspname AS schemaname, pg_tables| SELECT n.nspname AS schemaname,
c.relname AS tablename, c.relname AS tablename,
pg_get_userbyid(c.relowner) AS tableowner, pg_get_userbyid(c.relowner) AS tableowner,
t.spcname AS tablespace, t.spcname AS tablespace,
c.relhasindex AS hasindexes, c.relhasindex AS hasindexes,
c.relhasrules AS hasrules, c.relhasrules AS hasrules,
c.relhastriggers AS hastriggers c.relhastriggers AS hastriggers
FROM ((pg_class c FROM ((pg_class c
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
LEFT JOIN pg_tablespace t ON ((t.oid = c.reltablespace))) LEFT JOIN pg_tablespace t ON ((t.oid = c.reltablespace)))
WHERE (c.relkind = 'r'::"char"); WHERE (c.relkind = 'r'::"char");
pg_timezone_abbrevs| SELECT pg_timezone_abbrevs.abbrev, pg_timezone_abbrevs| SELECT pg_timezone_abbrevs.abbrev,
pg_timezone_abbrevs.utc_offset, pg_timezone_abbrevs.utc_offset,
pg_timezone_abbrevs.is_dst pg_timezone_abbrevs.is_dst
FROM pg_timezone_abbrevs() pg_timezone_abbrevs(abbrev, utc_offset, is_dst); FROM pg_timezone_abbrevs() pg_timezone_abbrevs(abbrev, utc_offset, is_dst);
pg_timezone_names| SELECT pg_timezone_names.name, pg_timezone_names| SELECT pg_timezone_names.name,
pg_timezone_names.abbrev, pg_timezone_names.abbrev,
pg_timezone_names.utc_offset, pg_timezone_names.utc_offset,
pg_timezone_names.is_dst pg_timezone_names.is_dst
FROM pg_timezone_names() pg_timezone_names(name, abbrev, utc_offset, is_dst); FROM pg_timezone_names() pg_timezone_names(name, abbrev, utc_offset, is_dst);
pg_user| SELECT pg_shadow.usename, pg_user| SELECT pg_shadow.usename,
pg_shadow.usesysid, pg_shadow.usesysid,
pg_shadow.usecreatedb, pg_shadow.usecreatedb,
pg_shadow.usesuper, pg_shadow.usesuper,
pg_shadow.usecatupd, pg_shadow.usecatupd,
pg_shadow.userepl, pg_shadow.userepl,
'********'::text AS passwd, '********'::text AS passwd,
pg_shadow.valuntil, pg_shadow.valuntil,
pg_shadow.useconfig pg_shadow.useconfig
FROM pg_shadow; FROM pg_shadow;
pg_user_mappings| SELECT u.oid AS umid, pg_user_mappings| SELECT u.oid AS umid,
s.oid AS srvid, s.oid AS srvid,
s.srvname, s.srvname,
u.umuser, u.umuser,
CASE CASE
WHEN (u.umuser = (0)::oid) THEN 'public'::name WHEN (u.umuser = (0)::oid) THEN 'public'::name
ELSE a.rolname ELSE a.rolname
END AS usename, END AS usename,
CASE CASE
WHEN (pg_has_role(s.srvowner, 'USAGE'::text) OR has_server_privilege(s.oid, 'USAGE'::text)) THEN u.umoptions WHEN (pg_has_role(s.srvowner, 'USAGE'::text) OR has_server_privilege(s.oid, 'USAGE'::text)) THEN u.umoptions
ELSE NULL::text[] ELSE NULL::text[]
...@@ -2035,106 +2035,106 @@ pg_user_mappings| SELECT u.oid AS umid, ...@@ -2035,106 +2035,106 @@ pg_user_mappings| SELECT u.oid AS umid,
FROM ((pg_user_mapping u FROM ((pg_user_mapping u
LEFT JOIN pg_authid a ON ((a.oid = u.umuser))) LEFT JOIN pg_authid a ON ((a.oid = u.umuser)))
JOIN pg_foreign_server s ON ((u.umserver = s.oid))); JOIN pg_foreign_server s ON ((u.umserver = s.oid)));
pg_views| SELECT n.nspname AS schemaname, pg_views| SELECT n.nspname AS schemaname,
c.relname AS viewname, c.relname AS viewname,
pg_get_userbyid(c.relowner) AS viewowner, pg_get_userbyid(c.relowner) AS viewowner,
pg_get_viewdef(c.oid) AS definition pg_get_viewdef(c.oid) AS definition
FROM (pg_class c FROM (pg_class c
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
WHERE (c.relkind = 'v'::"char"); WHERE (c.relkind = 'v'::"char");
rtest_v1| SELECT rtest_t1.a, rtest_v1| SELECT rtest_t1.a,
rtest_t1.b rtest_t1.b
FROM rtest_t1; FROM rtest_t1;
rtest_vcomp| SELECT x.part, rtest_vcomp| SELECT x.part,
(x.size * y.factor) AS size_in_cm (x.size * y.factor) AS size_in_cm
FROM rtest_comp x, FROM rtest_comp x,
rtest_unitfact y rtest_unitfact y
WHERE (x.unit = y.unit); WHERE (x.unit = y.unit);
rtest_vview1| SELECT x.a, rtest_vview1| SELECT x.a,
x.b x.b
FROM rtest_view1 x FROM rtest_view1 x
WHERE (0 < ( SELECT count(*) AS count WHERE (0 < ( SELECT count(*) AS count
FROM rtest_view2 y FROM rtest_view2 y
WHERE (y.a = x.a))); WHERE (y.a = x.a)));
rtest_vview2| SELECT rtest_view1.a, rtest_vview2| SELECT rtest_view1.a,
rtest_view1.b rtest_view1.b
FROM rtest_view1 FROM rtest_view1
WHERE rtest_view1.v; WHERE rtest_view1.v;
rtest_vview3| SELECT x.a, rtest_vview3| SELECT x.a,
x.b x.b
FROM rtest_vview2 x FROM rtest_vview2 x
WHERE (0 < ( SELECT count(*) AS count WHERE (0 < ( SELECT count(*) AS count
FROM rtest_view2 y FROM rtest_view2 y
WHERE (y.a = x.a))); WHERE (y.a = x.a)));
rtest_vview4| SELECT x.a, rtest_vview4| SELECT x.a,
x.b, x.b,
count(y.a) AS refcount count(y.a) AS refcount
FROM rtest_view1 x, FROM rtest_view1 x,
rtest_view2 y rtest_view2 y
WHERE (x.a = y.a) WHERE (x.a = y.a)
GROUP BY x.a, x.b; GROUP BY x.a, x.b;
rtest_vview5| SELECT rtest_view1.a, rtest_vview5| SELECT rtest_view1.a,
rtest_view1.b, rtest_view1.b,
rtest_viewfunc1(rtest_view1.a) AS refcount rtest_viewfunc1(rtest_view1.a) AS refcount
FROM rtest_view1; FROM rtest_view1;
shoe| SELECT sh.shoename, shoe| SELECT sh.shoename,
sh.sh_avail, sh.sh_avail,
sh.slcolor, sh.slcolor,
sh.slminlen, sh.slminlen,
(sh.slminlen * un.un_fact) AS slminlen_cm, (sh.slminlen * un.un_fact) AS slminlen_cm,
sh.slmaxlen, sh.slmaxlen,
(sh.slmaxlen * un.un_fact) AS slmaxlen_cm, (sh.slmaxlen * un.un_fact) AS slmaxlen_cm,
sh.slunit sh.slunit
FROM shoe_data sh, FROM shoe_data sh,
unit un unit un
WHERE (sh.slunit = un.un_name); WHERE (sh.slunit = un.un_name);
shoe_ready| SELECT rsh.shoename, shoe_ready| SELECT rsh.shoename,
rsh.sh_avail, rsh.sh_avail,
rsl.sl_name, rsl.sl_name,
rsl.sl_avail, rsl.sl_avail,
int4smaller(rsh.sh_avail, rsl.sl_avail) AS total_avail int4smaller(rsh.sh_avail, rsl.sl_avail) AS total_avail
FROM shoe rsh, FROM shoe rsh,
shoelace rsl shoelace rsl
WHERE (((rsl.sl_color = rsh.slcolor) AND (rsl.sl_len_cm >= rsh.slminlen_cm)) AND (rsl.sl_len_cm <= rsh.slmaxlen_cm)); WHERE (((rsl.sl_color = rsh.slcolor) AND (rsl.sl_len_cm >= rsh.slminlen_cm)) AND (rsl.sl_len_cm <= rsh.slmaxlen_cm));
shoelace| SELECT s.sl_name, shoelace| SELECT s.sl_name,
s.sl_avail, s.sl_avail,
s.sl_color, s.sl_color,
s.sl_len, s.sl_len,
s.sl_unit, s.sl_unit,
(s.sl_len * u.un_fact) AS sl_len_cm (s.sl_len * u.un_fact) AS sl_len_cm
FROM shoelace_data s, FROM shoelace_data s,
unit u unit u
WHERE (s.sl_unit = u.un_name); WHERE (s.sl_unit = u.un_name);
shoelace_candelete| SELECT shoelace_obsolete.sl_name, shoelace_candelete| SELECT shoelace_obsolete.sl_name,
shoelace_obsolete.sl_avail, shoelace_obsolete.sl_avail,
shoelace_obsolete.sl_color, shoelace_obsolete.sl_color,
shoelace_obsolete.sl_len, shoelace_obsolete.sl_len,
shoelace_obsolete.sl_unit, shoelace_obsolete.sl_unit,
shoelace_obsolete.sl_len_cm shoelace_obsolete.sl_len_cm
FROM shoelace_obsolete FROM shoelace_obsolete
WHERE (shoelace_obsolete.sl_avail = 0); WHERE (shoelace_obsolete.sl_avail = 0);
shoelace_obsolete| SELECT shoelace.sl_name, shoelace_obsolete| SELECT shoelace.sl_name,
shoelace.sl_avail, shoelace.sl_avail,
shoelace.sl_color, shoelace.sl_color,
shoelace.sl_len, shoelace.sl_len,
shoelace.sl_unit, shoelace.sl_unit,
shoelace.sl_len_cm shoelace.sl_len_cm
FROM shoelace FROM shoelace
WHERE (NOT (EXISTS ( SELECT shoe.shoename WHERE (NOT (EXISTS ( SELECT shoe.shoename
FROM shoe FROM shoe
WHERE (shoe.slcolor = shoelace.sl_color)))); WHERE (shoe.slcolor = shoelace.sl_color))));
street| SELECT r.name, street| SELECT r.name,
r.thepath, r.thepath,
c.cname c.cname
FROM ONLY road r, FROM ONLY road r,
real_city c real_city c
WHERE (c.outline ## r.thepath); WHERE (c.outline ## r.thepath);
toyemp| SELECT emp.name, toyemp| SELECT emp.name,
emp.age, emp.age,
emp.location, emp.location,
(12 * emp.salary) AS annualsal (12 * emp.salary) AS annualsal
FROM emp; FROM emp;
tv| SELECT t.type, tv| SELECT t.type,
sum(t.amt) AS totamt sum(t.amt) AS totamt
FROM t FROM t
GROUP BY t.type; GROUP BY t.type;
...@@ -2150,14 +2150,14 @@ pg_settings|pg_settings_u|CREATE RULE pg_settings_u AS ...@@ -2150,14 +2150,14 @@ pg_settings|pg_settings_u|CREATE RULE pg_settings_u AS
ON UPDATE TO pg_settings ON UPDATE TO pg_settings
WHERE (new.name = old.name) DO SELECT set_config(old.name, new.setting, false) AS set_config; WHERE (new.name = old.name) DO SELECT set_config(old.name, new.setting, false) AS set_config;
rtest_emp|rtest_emp_del|CREATE RULE rtest_emp_del AS rtest_emp|rtest_emp_del|CREATE RULE rtest_emp_del AS
ON DELETE TO rtest_emp DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal) ON DELETE TO rtest_emp DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal)
VALUES (old.ename, "current_user"(), 'fired'::bpchar, '$0.00'::money, old.salary); VALUES (old.ename, "current_user"(), 'fired'::bpchar, '$0.00'::money, old.salary);
rtest_emp|rtest_emp_ins|CREATE RULE rtest_emp_ins AS rtest_emp|rtest_emp_ins|CREATE RULE rtest_emp_ins AS
ON INSERT TO rtest_emp DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal) ON INSERT TO rtest_emp DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal)
VALUES (new.ename, "current_user"(), 'hired'::bpchar, new.salary, '$0.00'::money); VALUES (new.ename, "current_user"(), 'hired'::bpchar, new.salary, '$0.00'::money);
rtest_emp|rtest_emp_upd|CREATE RULE rtest_emp_upd AS rtest_emp|rtest_emp_upd|CREATE RULE rtest_emp_upd AS
ON UPDATE TO rtest_emp ON UPDATE TO rtest_emp
WHERE (new.salary <> old.salary) DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal) WHERE (new.salary <> old.salary) DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal)
VALUES (new.ename, "current_user"(), 'honored'::bpchar, new.salary, old.salary); VALUES (new.ename, "current_user"(), 'honored'::bpchar, new.salary, old.salary);
rtest_nothn1|rtest_nothn_r1|CREATE RULE rtest_nothn_r1 AS rtest_nothn1|rtest_nothn_r1|CREATE RULE rtest_nothn_r1 AS
ON INSERT TO rtest_nothn1 ON INSERT TO rtest_nothn1
...@@ -2167,22 +2167,22 @@ rtest_nothn1|rtest_nothn_r2|CREATE RULE rtest_nothn_r2 AS ...@@ -2167,22 +2167,22 @@ rtest_nothn1|rtest_nothn_r2|CREATE RULE rtest_nothn_r2 AS
WHERE ((new.a >= 30) AND (new.a < 40)) DO INSTEAD NOTHING; WHERE ((new.a >= 30) AND (new.a < 40)) DO INSTEAD NOTHING;
rtest_nothn2|rtest_nothn_r3|CREATE RULE rtest_nothn_r3 AS rtest_nothn2|rtest_nothn_r3|CREATE RULE rtest_nothn_r3 AS
ON INSERT TO rtest_nothn2 ON INSERT TO rtest_nothn2
WHERE (new.a >= 100) DO INSTEAD INSERT INTO rtest_nothn3 (a, b) WHERE (new.a >= 100) DO INSTEAD INSERT INTO rtest_nothn3 (a, b)
VALUES (new.a, new.b); VALUES (new.a, new.b);
rtest_nothn2|rtest_nothn_r4|CREATE RULE rtest_nothn_r4 AS rtest_nothn2|rtest_nothn_r4|CREATE RULE rtest_nothn_r4 AS
ON INSERT TO rtest_nothn2 DO INSTEAD NOTHING; ON INSERT TO rtest_nothn2 DO INSTEAD NOTHING;
rtest_order1|rtest_order_r1|CREATE RULE rtest_order_r1 AS rtest_order1|rtest_order_r1|CREATE RULE rtest_order_r1 AS
ON INSERT TO rtest_order1 DO INSTEAD INSERT INTO rtest_order2 (a, b, c) ON INSERT TO rtest_order1 DO INSTEAD INSERT INTO rtest_order2 (a, b, c)
VALUES (new.a, nextval('rtest_seq'::regclass), 'rule 1 - this should run 1st'::text); VALUES (new.a, nextval('rtest_seq'::regclass), 'rule 1 - this should run 1st'::text);
rtest_order1|rtest_order_r2|CREATE RULE rtest_order_r2 AS rtest_order1|rtest_order_r2|CREATE RULE rtest_order_r2 AS
ON INSERT TO rtest_order1 DO INSERT INTO rtest_order2 (a, b, c) ON INSERT TO rtest_order1 DO INSERT INTO rtest_order2 (a, b, c)
VALUES (new.a, nextval('rtest_seq'::regclass), 'rule 2 - this should run 2nd'::text); VALUES (new.a, nextval('rtest_seq'::regclass), 'rule 2 - this should run 2nd'::text);
rtest_order1|rtest_order_r3|CREATE RULE rtest_order_r3 AS rtest_order1|rtest_order_r3|CREATE RULE rtest_order_r3 AS
ON INSERT TO rtest_order1 DO INSTEAD INSERT INTO rtest_order2 (a, b, c) ON INSERT TO rtest_order1 DO INSTEAD INSERT INTO rtest_order2 (a, b, c)
VALUES (new.a, nextval('rtest_seq'::regclass), 'rule 3 - this should run 3rd'::text); VALUES (new.a, nextval('rtest_seq'::regclass), 'rule 3 - this should run 3rd'::text);
rtest_order1|rtest_order_r4|CREATE RULE rtest_order_r4 AS rtest_order1|rtest_order_r4|CREATE RULE rtest_order_r4 AS
ON INSERT TO rtest_order1 ON INSERT TO rtest_order1
WHERE (new.a < 100) DO INSTEAD INSERT INTO rtest_order2 (a, b, c) WHERE (new.a < 100) DO INSTEAD INSERT INTO rtest_order2 (a, b, c)
VALUES (new.a, nextval('rtest_seq'::regclass), 'rule 4 - this should run 4th'::text); VALUES (new.a, nextval('rtest_seq'::regclass), 'rule 4 - this should run 4th'::text);
rtest_person|rtest_pers_del|CREATE RULE rtest_pers_del AS rtest_person|rtest_pers_del|CREATE RULE rtest_pers_del AS
ON DELETE TO rtest_person DO DELETE FROM rtest_admin ON DELETE TO rtest_person DO DELETE FROM rtest_admin
...@@ -2204,25 +2204,25 @@ rtest_system|rtest_sys_upd|CREATE RULE rtest_sys_upd AS ...@@ -2204,25 +2204,25 @@ rtest_system|rtest_sys_upd|CREATE RULE rtest_sys_upd AS
); );
rtest_t4|rtest_t4_ins1|CREATE RULE rtest_t4_ins1 AS rtest_t4|rtest_t4_ins1|CREATE RULE rtest_t4_ins1 AS
ON INSERT TO rtest_t4 ON INSERT TO rtest_t4
WHERE ((new.a >= 10) AND (new.a < 20)) DO INSTEAD INSERT INTO rtest_t5 (a, b) WHERE ((new.a >= 10) AND (new.a < 20)) DO INSTEAD INSERT INTO rtest_t5 (a, b)
VALUES (new.a, new.b); VALUES (new.a, new.b);
rtest_t4|rtest_t4_ins2|CREATE RULE rtest_t4_ins2 AS rtest_t4|rtest_t4_ins2|CREATE RULE rtest_t4_ins2 AS
ON INSERT TO rtest_t4 ON INSERT TO rtest_t4
WHERE ((new.a >= 20) AND (new.a < 30)) DO INSERT INTO rtest_t6 (a, b) WHERE ((new.a >= 20) AND (new.a < 30)) DO INSERT INTO rtest_t6 (a, b)
VALUES (new.a, new.b); VALUES (new.a, new.b);
rtest_t5|rtest_t5_ins|CREATE RULE rtest_t5_ins AS rtest_t5|rtest_t5_ins|CREATE RULE rtest_t5_ins AS
ON INSERT TO rtest_t5 ON INSERT TO rtest_t5
WHERE (new.a > 15) DO INSERT INTO rtest_t7 (a, b) WHERE (new.a > 15) DO INSERT INTO rtest_t7 (a, b)
VALUES (new.a, new.b); VALUES (new.a, new.b);
rtest_t6|rtest_t6_ins|CREATE RULE rtest_t6_ins AS rtest_t6|rtest_t6_ins|CREATE RULE rtest_t6_ins AS
ON INSERT TO rtest_t6 ON INSERT TO rtest_t6
WHERE (new.a > 25) DO INSTEAD INSERT INTO rtest_t8 (a, b) WHERE (new.a > 25) DO INSTEAD INSERT INTO rtest_t8 (a, b)
VALUES (new.a, new.b); VALUES (new.a, new.b);
rtest_v1|rtest_v1_del|CREATE RULE rtest_v1_del AS rtest_v1|rtest_v1_del|CREATE RULE rtest_v1_del AS
ON DELETE TO rtest_v1 DO INSTEAD DELETE FROM rtest_t1 ON DELETE TO rtest_v1 DO INSTEAD DELETE FROM rtest_t1
WHERE (rtest_t1.a = old.a); WHERE (rtest_t1.a = old.a);
rtest_v1|rtest_v1_ins|CREATE RULE rtest_v1_ins AS rtest_v1|rtest_v1_ins|CREATE RULE rtest_v1_ins AS
ON INSERT TO rtest_v1 DO INSTEAD INSERT INTO rtest_t1 (a, b) ON INSERT TO rtest_v1 DO INSTEAD INSERT INTO rtest_t1 (a, b)
VALUES (new.a, new.b); VALUES (new.a, new.b);
rtest_v1|rtest_v1_upd|CREATE RULE rtest_v1_upd AS rtest_v1|rtest_v1_upd|CREATE RULE rtest_v1_upd AS
ON UPDATE TO rtest_v1 DO INSTEAD UPDATE rtest_t1 SET a = new.a, b = new.b ON UPDATE TO rtest_v1 DO INSTEAD UPDATE rtest_t1 SET a = new.a, b = new.b
...@@ -2231,14 +2231,14 @@ shoelace|shoelace_del|CREATE RULE shoelace_del AS ...@@ -2231,14 +2231,14 @@ shoelace|shoelace_del|CREATE RULE shoelace_del AS
ON DELETE TO shoelace DO INSTEAD DELETE FROM shoelace_data ON DELETE TO shoelace DO INSTEAD DELETE FROM shoelace_data
WHERE (shoelace_data.sl_name = old.sl_name); WHERE (shoelace_data.sl_name = old.sl_name);
shoelace|shoelace_ins|CREATE RULE shoelace_ins AS shoelace|shoelace_ins|CREATE RULE shoelace_ins AS
ON INSERT TO shoelace DO INSTEAD INSERT INTO shoelace_data (sl_name, sl_avail, sl_color, sl_len, sl_unit) ON INSERT TO shoelace DO INSTEAD INSERT INTO shoelace_data (sl_name, sl_avail, sl_color, sl_len, sl_unit)
VALUES (new.sl_name, new.sl_avail, new.sl_color, new.sl_len, new.sl_unit); VALUES (new.sl_name, new.sl_avail, new.sl_color, new.sl_len, new.sl_unit);
shoelace|shoelace_upd|CREATE RULE shoelace_upd AS shoelace|shoelace_upd|CREATE RULE shoelace_upd AS
ON UPDATE TO shoelace DO INSTEAD UPDATE shoelace_data SET sl_name = new.sl_name, sl_avail = new.sl_avail, sl_color = new.sl_color, sl_len = new.sl_len, sl_unit = new.sl_unit ON UPDATE TO shoelace DO INSTEAD UPDATE shoelace_data SET sl_name = new.sl_name, sl_avail = new.sl_avail, sl_color = new.sl_color, sl_len = new.sl_len, sl_unit = new.sl_unit
WHERE (shoelace_data.sl_name = old.sl_name); WHERE (shoelace_data.sl_name = old.sl_name);
shoelace_data|log_shoelace|CREATE RULE log_shoelace AS shoelace_data|log_shoelace|CREATE RULE log_shoelace AS
ON UPDATE TO shoelace_data ON UPDATE TO shoelace_data
WHERE (new.sl_avail <> old.sl_avail) DO INSERT INTO shoelace_log (sl_name, sl_avail, log_who, log_when) WHERE (new.sl_avail <> old.sl_avail) DO INSERT INTO shoelace_log (sl_name, sl_avail, log_who, log_when)
VALUES (new.sl_name, new.sl_avail, 'Al Bundy'::name, 'Thu Jan 01 00:00:00 1970'::timestamp without time zone); VALUES (new.sl_name, new.sl_avail, 'Al Bundy'::name, 'Thu Jan 01 00:00:00 1970'::timestamp without time zone);
shoelace_ok|shoelace_ok_ins|CREATE RULE shoelace_ok_ins AS shoelace_ok|shoelace_ok_ins|CREATE RULE shoelace_ok_ins AS
ON INSERT TO shoelace_ok DO INSTEAD UPDATE shoelace SET sl_avail = (shoelace.sl_avail + new.ok_quant) ON INSERT TO shoelace_ok DO INSTEAD UPDATE shoelace SET sl_avail = (shoelace.sl_avail + new.ok_quant)
...@@ -2460,50 +2460,50 @@ select * from only t1_2; ...@@ -2460,50 +2460,50 @@ select * from only t1_2;
-- test various flavors of pg_get_viewdef() -- test various flavors of pg_get_viewdef()
select pg_get_viewdef('shoe'::regclass) as unpretty; select pg_get_viewdef('shoe'::regclass) as unpretty;
unpretty unpretty
------------------------------------------------- ------------------------------------------------
SELECT sh.shoename, + SELECT sh.shoename, +
sh.sh_avail, + sh.sh_avail, +
sh.slcolor, + sh.slcolor, +
sh.slminlen, + sh.slminlen, +
(sh.slminlen * un.un_fact) AS slminlen_cm, + (sh.slminlen * un.un_fact) AS slminlen_cm,+
sh.slmaxlen, + sh.slmaxlen, +
(sh.slmaxlen * un.un_fact) AS slmaxlen_cm, + (sh.slmaxlen * un.un_fact) AS slmaxlen_cm,+
sh.slunit + sh.slunit +
FROM shoe_data sh, + FROM shoe_data sh, +
unit un + unit un +
WHERE (sh.slunit = un.un_name); WHERE (sh.slunit = un.un_name);
(1 row) (1 row)
select pg_get_viewdef('shoe'::regclass,true) as pretty; select pg_get_viewdef('shoe'::regclass,true) as pretty;
pretty pretty
----------------------------------------------- ----------------------------------------------
SELECT sh.shoename, + SELECT sh.shoename, +
sh.sh_avail, + sh.sh_avail, +
sh.slcolor, + sh.slcolor, +
sh.slminlen, + sh.slminlen, +
sh.slminlen * un.un_fact AS slminlen_cm, + sh.slminlen * un.un_fact AS slminlen_cm,+
sh.slmaxlen, + sh.slmaxlen, +
sh.slmaxlen * un.un_fact AS slmaxlen_cm, + sh.slmaxlen * un.un_fact AS slmaxlen_cm,+
sh.slunit + sh.slunit +
FROM shoe_data sh, + FROM shoe_data sh, +
unit un + unit un +
WHERE sh.slunit = un.un_name; WHERE sh.slunit = un.un_name;
(1 row) (1 row)
select pg_get_viewdef('shoe'::regclass,0) as prettier; select pg_get_viewdef('shoe'::regclass,0) as prettier;
prettier prettier
----------------------------------------------- ----------------------------------------------
SELECT sh.shoename, + SELECT sh.shoename, +
sh.sh_avail, + sh.sh_avail, +
sh.slcolor, + sh.slcolor, +
sh.slminlen, + sh.slminlen, +
sh.slminlen * un.un_fact AS slminlen_cm, + sh.slminlen * un.un_fact AS slminlen_cm,+
sh.slmaxlen, + sh.slmaxlen, +
sh.slmaxlen * un.un_fact AS slmaxlen_cm, + sh.slmaxlen * un.un_fact AS slmaxlen_cm,+
sh.slunit + sh.slunit +
FROM shoe_data sh, + FROM shoe_data sh, +
unit un + unit un +
WHERE sh.slunit = un.un_name; WHERE sh.slunit = un.un_name;
(1 row) (1 row)
...@@ -2585,7 +2585,7 @@ Rules: ...@@ -2585,7 +2585,7 @@ Rules:
r2 AS r2 AS
ON UPDATE TO rules_src DO VALUES (old.f1,old.f2,'old'::text), (new.f1,new.f2,'new'::text) ON UPDATE TO rules_src DO VALUES (old.f1,old.f2,'old'::text), (new.f1,new.f2,'new'::text)
r3 AS r3 AS
ON DELETE TO rules_src DO ON DELETE TO rules_src DO
NOTIFY rules_src_deletion NOTIFY rules_src_deletion
Has OIDs: no Has OIDs: no
...@@ -2616,7 +2616,7 @@ View definition: ...@@ -2616,7 +2616,7 @@ View definition:
FROM rule_t1; FROM rule_t1;
Rules: Rules:
newinsertrule AS newinsertrule AS
ON INSERT TO rule_v1 DO INSTEAD INSERT INTO rule_t1 (a) ON INSERT TO rule_v1 DO INSTEAD INSERT INTO rule_t1 (a)
VALUES (new.a) VALUES (new.a)
-- --
......
...@@ -1119,7 +1119,7 @@ DROP TRIGGER instead_of_delete_trig ON main_view; ...@@ -1119,7 +1119,7 @@ DROP TRIGGER instead_of_delete_trig ON main_view;
a | integer | | plain | a | integer | | plain |
b | integer | | plain | b | integer | | plain |
View definition: View definition:
SELECT main_table.a, SELECT main_table.a,
main_table.b main_table.b
FROM main_table; FROM main_table;
Triggers: Triggers:
......
...@@ -1389,7 +1389,7 @@ CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a < b ...@@ -1389,7 +1389,7 @@ CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a < b
a | integer | | plain | a | integer | | plain |
b | integer | | plain | b | integer | | plain |
View definition: View definition:
SELECT base_tbl.a, SELECT base_tbl.a,
base_tbl.b base_tbl.b
FROM base_tbl FROM base_tbl
WHERE base_tbl.a < base_tbl.b; WHERE base_tbl.a < base_tbl.b;
......
...@@ -361,7 +361,7 @@ SELECT sum(n) FROM t; ...@@ -361,7 +361,7 @@ SELECT sum(n) FROM t;
View definition: View definition:
WITH RECURSIVE t(n) AS ( WITH RECURSIVE t(n) AS (
VALUES (1) VALUES (1)
UNION ALL UNION ALL
SELECT t_1.n + 1 SELECT t_1.n + 1
FROM t t_1 FROM t t_1
WHERE t_1.n < 100 WHERE t_1.n < 100
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment