mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
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 2f582f76b1
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.
This commit is contained in:
parent
648bd05b13
commit
0b7e660d6c
@ -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,
|
|||||||
/* 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;
|
||||||
if (targetbuf.data[pos] == '\n')
|
|
||||||
{
|
|
||||||
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++;
|
leading_nl_pos = -1;
|
||||||
|
|
||||||
/*
|
/* If so, we shouldn't add anything */
|
||||||
* If the field we're adding is the first in the list, or it
|
if (leading_nl_pos >= 0)
|
||||||
* already has a leading newline, don't add anything. Otherwise,
|
{
|
||||||
* add a newline, plus some indentation, if either the new field
|
/* instead, remove any trailing spaces currently in buf */
|
||||||
* would cause an overflow or the last field used more than one
|
removeStringInfoSpaces(buf);
|
||||||
* line.
|
}
|
||||||
*/
|
else
|
||||||
if (colno > 1 &&
|
{
|
||||||
leading_nl_pos == -1 &&
|
char *trailing_nl;
|
||||||
((strlen(trailing_nl) + strlen(targetbuf.data) > context->wrapColumn) ||
|
|
||||||
last_was_multiline))
|
/* Locate the start of the current line in the output buffer */
|
||||||
appendContextKeyword(context, "", -PRETTYINDENT_STD,
|
trailing_nl = strrchr(buf->data, '\n');
|
||||||
PRETTYINDENT_STD, PRETTYINDENT_VAR);
|
if (trailing_nl == NULL)
|
||||||
|
trailing_nl = buf->data;
|
||||||
|
else
|
||||||
|
trailing_nl++;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add a newline, plus some indentation, if the new field is
|
||||||
|
* not the first and either the new field would cause an
|
||||||
|
* overflow or the last field used more than one line.
|
||||||
|
*/
|
||||||
|
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
|
|||||||
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)
|
|||||||
/* 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;
|
|||||||
(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;
|
|||||||
(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;
|
|||||||
(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
|
|||||||
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:
|
|||||||
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:
|
|||||||
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:
|
|||||||
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;
|
|||||||
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:
|
|||||||
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:
|
|||||||
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:
|
|||||||
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;
|
|||||||
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:
|
|||||||
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:
|
|||||||
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:
|
|||||||
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;
|
|||||||
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:
|
|||||||
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:
|
|||||||
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:
|
|||||||
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;
|
|||||||
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:
|
|||||||
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:
|
|||||||
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:
|
|||||||
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;
|
|||||||
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:
|
|||||||
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:
|
|||||||
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:
|
|||||||
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);
|
|||||||
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:
|
|||||||
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;
|
|||||||
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
|
|||||||
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
|
|||||||
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;
|
|||||||
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;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -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
|
|||||||
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;
|
|||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user