From: Nathan Bossart <nathandbossart@gmail.com>
To: Vik Fearing <vik@postgresfriends.org>
Cc: Zsolt Parragi <zsolt.parragi@percona.com>
Cc: pgsql-hackers@lists.postgresql.org, Jacob Champion <jacob.champion@enterprisedb.com>
Cc: Isaac Morland <isaac.morland@gmail.com>
Subject: Re: Logical Implication
Date: Wed, 18 Nov 2026 16:17:12 -0600
Message-ID: <av4j6LHrlJjI-Bs6@nathan> (raw)
In-Reply-To: <avzS-AuYzYKzhxL1@nathan>
References: <arU0qXcp3KSj7M-g@nathan>
<9ab35dbb-d9a4-4c1e-bae2-7763ddeb720c@postgresfriends.org>
<CAN4CZFPUmkNyYP=MJbCE3OC21-De9AYhJXOD_wd8Q06E6xBzqQ@mail.gmail.com>
<3d779ee0-6596-4dae-b79c-e35b237f83bf@postgresfriends.org>
<ar0mGmQQz6vI6pts@nathan>
<b70aba34-e799-4c09-aa3e-281a335ebf2f@postgresfriends.org>
<asU7s4y_QzU7yJVZ@nathan>
<au4zAwo3wQ-KfOh-@nathan>
<avIyDcgAN1YufY1U@nathan>
<avzS-AuYzYKzhxL1@nathan>
On Tue, Nov 17, 2026 at 04:19:36PM -0600, Nathan Bossart wrote:
> I spent some time on the main patch and came up with the following. I
> think it's in decent shape, but it probably ought to go through another
> round of both human and LLM review.
Besides a missing update in the documentation, the only other thing the LLM
found that seemed worth fixing was to handle IMPLIES in
simplify_or_arguments(), and even that seems unlikely to matter much with
realistic usage.
It also found that using IMPLIES with BETWEEN (e.g., ROWS BETWEEN
implies(1) PRECEDING AND CURRENT ROW) is now a syntax error. This feels
like the sort of thing we probably wouldn't have ever noticed without an
LLM, and fixing it seems to require breaking something else, so IMHO we
should just leave it alone. I'll give it another try to be sure, though.
--
nathan
Attachments:v6-0001-Add-IMPLIES-logical-operator.patch (text/plain, 20.0K) download
From 9753c03cb4bfc86282afd695d511dd4dcce89c20 Mon Sep 17 00:00:00 2001
From: Nathan Bossart <nathan@postgresql.org>
Date: Wed, 18 Nov 2026 16:16:01 -0600
Subject: [PATCH v6 1/1] Add IMPLIES logical operator.
This commit adds an IMPLIES operator for boolean values.
"a IMPLIES b" is equivalent to "NOT a OR b", but it is easier to
read in conditional rules like CHECK constraints. For example,
CHECK (NOT shipped OR ship_date IS NOT NULL)
can now be written as
CHECK (shipped IMPLIES ship_date IS NOT NULL)
NULL handling follows from the equivalence above, which means that
IMPLIES uses Kleene's definition of implication for three-valued
logic. Like AND and OR, there is no guarantee that the left
operand is evaluated before the right operand.
IMPLIES is non-associative, so "a IMPLIES b IMPLIES c" is a syntax
error. There is no consensus on how such chains ought to be
grouped, and requiring parentheses leaves the door open for
choosing an associativity later (e.g., if the SQL standard picks
one).
To allow views, constraints, etc. to be deparsed and dumped as
written, IMPLIES is stored as a new BoolExprType instead of being
expanded during parse analysis. The planner replaces it with the
equivalent NOT and OR during expression preprocessing, so the
executor and most of the planner never see it.
XXX: Bump catversion.
Author: Vik Fearing <vik@postgresfriends.org>
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Tested-by: solai v <solai.cdac@gmail.com>
Discussion: https://postgr.es/m/37c76707-e6fa-4ee3-b57f-aa0bf1b0bba8%40postgresfriends.org
---
contrib/postgres_fdw/deparse.c | 3 ++
doc/src/sgml/func/func-logical.sgml | 61 +++++++++++++++++++++--
doc/src/sgml/syntax.sgml | 10 +++-
src/backend/nodes/outfuncs.c | 3 ++
src/backend/nodes/readfuncs.c | 2 +
src/backend/optimizer/util/clauses.c | 48 +++++++++++++++++-
src/backend/parser/gram.y | 10 +++-
src/backend/parser/parse_expr.c | 3 ++
src/backend/utils/adt/ruleutils.c | 22 +++++++-
src/include/nodes/primnodes.h | 11 ++--
src/include/parser/kwlist.h | 1 +
src/test/regress/expected/boolean.out | 61 +++++++++++++++++++++++
src/test/regress/expected/create_view.out | 8 ++-
src/test/regress/sql/boolean.sql | 15 ++++++
src/test/regress/sql/create_view.sql | 4 +-
15 files changed, 245 insertions(+), 17 deletions(-)
diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.cindex ff9fe0f87e4..82775ab78c7 100644--- a/contrib/postgres_fdw/deparse.c+++ b/contrib/postgres_fdw/deparse.c@@ -3749,6 +3749,9 @@ deparseBoolExpr(BoolExpr *node, deparse_expr_cxt *context)
deparseExpr(linitial(node->args), context);
appendStringInfoChar(buf, ')');
return;
+ default:+ elog(ERROR, "unrecognized boolop: %d", (int) node->boolop);+ break;
}
appendStringInfoChar(buf, '(');
diff --git a/doc/src/sgml/func/func-logical.sgml b/doc/src/sgml/func/func-logical.sgmlindex 28d49b61a89..8fc2de853e0 100644--- a/doc/src/sgml/func/func-logical.sgml+++ b/doc/src/sgml/func/func-logical.sgml@@ -13,7 +13,7 @@
</indexterm>
<para>
- The usual logical operators are available:+ The following logical operators are available:
<indexterm>
<primary>AND (operator)</primary>
@@ -39,10 +39,19 @@
<primary>negation</primary>
</indexterm>
+ <indexterm>+ <primary>IMPLIES (operator)</primary>+ </indexterm>++ <indexterm>+ <primary>implication</primary>+ </indexterm>+
<synopsis>
<type>boolean</type> <literal>AND</literal> <type>boolean</type> <returnvalue>boolean</returnvalue>
<type>boolean</type> <literal>OR</literal> <type>boolean</type> <returnvalue>boolean</returnvalue>
<literal>NOT</literal> <type>boolean</type> <returnvalue>boolean</returnvalue>
+<type>boolean</type> <literal>IMPLIES</literal> <type>boolean</type> <returnvalue>boolean</returnvalue>
</synopsis>
<acronym>SQL</acronym> uses a three-valued logic system with true,
@@ -143,14 +152,56 @@
</tbody>
</tgroup>
</informaltable>
++ <informaltable rowheader="firstcol">+ <tgroup cols="4">+ <thead>+ <row>+ <entry>IMPLIES</entry>+ <entry>TRUE</entry>+ <entry>FALSE</entry>+ <entry>NULL</entry>+ </row>+ </thead>++ <tbody>+ <row>+ <entry>TRUE</entry>+ <entry>TRUE</entry>+ <entry>FALSE</entry>+ <entry>NULL</entry>+ </row>++ <row>+ <entry>FALSE</entry>+ <entry>TRUE</entry>+ <entry>TRUE</entry>+ <entry>TRUE</entry>+ </row>++ <row>+ <entry>NULL</entry>+ <entry>TRUE</entry>+ <entry>NULL</entry>+ <entry>NULL</entry>+ </row>+ </tbody>+ </tgroup>+ </informaltable>
</para>
<para>
The operators <literal>AND</literal> and <literal>OR</literal> are
commutative, that is, you can switch the left and right operands
- without affecting the result. (However, it is not guaranteed that- the left operand is evaluated before the right operand. See <xref- linkend="syntax-express-eval"/> for more information about the- order of evaluation of subexpressions.)+ without affecting the result. <literal>IMPLIES</literal> is not+ commutative.+ </para>++ <para>+ Note that it is not guaranteed that the left operand of+ <literal>AND</literal>, <literal>OR</literal>, or+ <literal>IMPLIES</literal> is evaluated before the right operand. See+ <xref linkend="syntax-express-eval"/> for more information about the+ order of evaluation of subexpressions.
</para>
</sect1>
diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgmlindex a697218c8b3..320b33bd898 100644--- a/doc/src/sgml/syntax.sgml+++ b/doc/src/sgml/syntax.sgml@@ -1103,6 +1103,12 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<entry>left</entry>
<entry>logical disjunction</entry>
</row>
++ <row>+ <entry><token>IMPLIES</token></entry>+ <entry></entry>+ <entry>logical implication</entry>+ </row>
</tbody>
</tgroup>
</table>
@@ -1468,8 +1474,8 @@ $1.somecolumn
</simplelist>
where the <replaceable>operator</replaceable> token follows the syntax
rules of <xref linkend="sql-syntax-operators"/>, or is one of the
- key words <token>AND</token>, <token>OR</token>, and- <token>NOT</token>, or is a qualified operator name in the form:+ key words <token>AND</token>, <token>OR</token>, <token>NOT</token>, and+ <token>IMPLIES</token>, or is a qualified operator name in the form:
<synopsis>
<literal>OPERATOR(</literal><replaceable>schema</replaceable><literal>.</literal><replaceable>operatorname</replaceable><literal>)</literal>
</synopsis>
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.cindex 40990143927..396b340c01e 100644--- a/src/backend/nodes/outfuncs.c+++ b/src/backend/nodes/outfuncs.c@@ -422,6 +422,9 @@ _outBoolExpr(StringInfo str, const BoolExpr *node)
case NOT_EXPR:
opstr = "not";
break;
+ case IMPLIES_EXPR:+ opstr = "implies";+ break;
}
appendStringInfoString(str, " :boolop ");
outToken(str, opstr);
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.cindex 2839a711f9e..8f2aa6c7cbe 100644--- a/src/backend/nodes/readfuncs.c+++ b/src/backend/nodes/readfuncs.c@@ -295,6 +295,8 @@ _readBoolExpr(ReadNodeContext *ctx)
local_node->boolop = OR_EXPR;
else if (length == 3 && strncmp(token, "not", 3) == 0)
local_node->boolop = NOT_EXPR;
+ else if (length == 7 && strncmp(token, "implies", 7) == 0)+ local_node->boolop = IMPLIES_EXPR;
else
elog(ERROR, "unrecognized boolop \"%.*s\"", length, token);
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.cindex 702fa0aefdd..bf2af6b8c23 100644--- a/src/backend/optimizer/util/clauses.c+++ b/src/backend/optimizer/util/clauses.c@@ -1142,7 +1142,8 @@ contain_nonstrict_functions_walker(Node *node, void *context)
{
case AND_EXPR:
case OR_EXPR:
- /* AND, OR are inherently non-strict */+ case IMPLIES_EXPR:+ /* AND, OR, IMPLIES are inherently non-strict */
return true;
default:
break;
@@ -1950,6 +1951,20 @@ find_nonnullable_vars_walker(Node *node, bool top_level)
result = find_nonnullable_vars_walker((Node *) expr->args,
false);
break;
+ case IMPLIES_EXPR:++ /*+ * "a IMPLIES b" means "NOT a OR b", so we handle the+ * arguments just like the NOT and OR cases would. Note that+ * we can get here before the planner has replaced IMPLIES+ * (see query_outputs_are_not_nullable()).+ */+ result = find_nonnullable_vars_walker(linitial(expr->args),+ false);+ result = mbms_int_members(result,+ find_nonnullable_vars_walker(lsecond(expr->args),+ top_level));+ break;
default:
elog(ERROR, "unrecognized boolop: %d", (int) expr->boolop);
break;
@@ -3393,6 +3408,22 @@ eval_const_expressions_mutator(Node *node,
*/
return negate_clause(arg);
}
+ case IMPLIES_EXPR:+ {+ Expr *newexpr;++ /*+ * Replace "a IMPLIES b" with "NOT a OR b" and+ * simplify that, so that nothing downstream needs+ * to know about IMPLIES.+ */+ Assert(list_length(expr->args) == 2);+ newexpr = make_notclause(linitial(expr->args));+ newexpr = make_orclause(list_make2(newexpr,+ lsecond(expr->args)));+ return eval_const_expressions_mutator((Node *) newexpr,+ context);+ }
default:
elog(ERROR, "unrecognized boolop: %d",
(int) expr->boolop);
@@ -4473,6 +4504,21 @@ simplify_or_arguments(List *args,
continue;
}
+ /*+ * IMPLIES is an OR in disguise, so flatten it, too. Otherwise, its+ * arguments would be simplified a second time by the recheck below.+ */+ if (IsA(arg, BoolExpr) &&+ ((BoolExpr *) arg)->boolop == IMPLIES_EXPR)+ {+ BoolExpr *expr = (BoolExpr *) arg;++ unprocessed_args = lcons(lsecond(expr->args), unprocessed_args);+ unprocessed_args = lcons(make_notclause(linitial(expr->args)),+ unprocessed_args);+ continue;+ }+
/* If it's not an OR, simplify it */
arg = eval_const_expressions_mutator(arg, context);
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.yindex 0563453fe24..f370da66c28 100644--- a/src/backend/parser/gram.y+++ b/src/backend/parser/gram.y@@ -749,7 +749,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
HANDLER HAVING HEADER_P HOLD HOUR_P
- IDENTITY_P IF_P IGNORE_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IMPORT_P IN_P INCLUDE+ IDENTITY_P IF_P IGNORE_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IMPLIES IMPORT_P IN_P INCLUDE
INCLUDING INCREMENT INDENT INDEX INDEXES INHERIT INHERITS INITIALLY INLINE_P
INNER_P INOUT INPUT_P INSENSITIVE INSERT INSTEAD INT_P INTEGER
INTERSECT INTERVAL INTO INVOKER IS ISNULL ISOLATION
@@ -844,6 +844,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
/* Precedence: lowest to highest */
%left UNION EXCEPT
%left INTERSECT
+%nonassoc IMPLIES
%left OR
%left AND
%right NOT
@@ -15374,6 +15375,11 @@ a_expr: c_expr { $$ = $1; }
{ $$ = makeAndExpr($1, $3, @2); }
| a_expr OR a_expr
{ $$ = makeOrExpr($1, $3, @2); }
+ | a_expr IMPLIES a_expr+ {+ $$ = (Node *) makeBoolExpr(IMPLIES_EXPR,+ list_make2($1, $3), @2);+ }
| NOT a_expr
{ $$ = makeNotExpr($2, @1); }
| NOT_LA a_expr %prec NOT
@@ -18190,6 +18196,7 @@ unreserved_keyword:
| IMMEDIATE
| IMMUTABLE
| IMPLICIT_P
+ | IMPLIES
| IMPORT_P
| INCLUDE
| INCLUDING
@@ -18782,6 +18789,7 @@ bare_label_keyword:
| IMMEDIATE
| IMMUTABLE
| IMPLICIT_P
+ | IMPLIES
| IMPORT_P
| IN_P
| INCLUDE
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.cindex e207b7a1978..1388cc8add6 100644--- a/src/backend/parser/parse_expr.c+++ b/src/backend/parser/parse_expr.c@@ -1428,6 +1428,9 @@ transformBoolExpr(ParseState *pstate, BoolExpr *a)
case NOT_EXPR:
opname = "NOT";
break;
+ case IMPLIES_EXPR:+ opname = "IMPLIES";+ break;
default:
elog(ERROR, "unrecognized boolop: %d", (int) a->boolop);
opname = NULL; /* keep compiler quiet */
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.cindex e9c1c9db1b1..49ce3d318d3 100644--- a/src/backend/utils/adt/ruleutils.c+++ b/src/backend/utils/adt/ruleutils.c@@ -9087,13 +9087,19 @@ isSimpleNode(Node *node, Node *parentNode, int prettyFlags)
{
case NOT_EXPR:
case AND_EXPR:
- if (parentType == AND_EXPR || parentType == OR_EXPR)+ if (parentType == AND_EXPR ||+ parentType == OR_EXPR ||+ parentType == IMPLIES_EXPR)
return true;
break;
case OR_EXPR:
- if (parentType == OR_EXPR)+ if (parentType == OR_EXPR ||+ parentType == IMPLIES_EXPR)
return true;
break;
+ case IMPLIES_EXPR:+ /* IMPLIES always needs parentheses. */+ break;
}
}
return false;
@@ -9569,6 +9575,18 @@ get_rule_expr(Node *node, deparse_context *context,
appendStringInfoChar(buf, ')');
break;
+ case IMPLIES_EXPR:+ if (!PRETTY_PAREN(context))+ appendStringInfoChar(buf, '(');+ get_rule_expr_paren(first_arg, context,+ false, node);+ appendStringInfoString(buf, " IMPLIES ");+ get_rule_expr_paren(lsecond(expr->args), context,+ false, node);+ if (!PRETTY_PAREN(context))+ appendStringInfoChar(buf, ')');+ break;+
default:
elog(ERROR, "unrecognized boolop: %d",
(int) expr->boolop);
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.hindex 726c186c7d2..ce800ccecf5 100644--- a/src/include/nodes/primnodes.h+++ b/src/include/nodes/primnodes.h@@ -938,15 +938,20 @@ typedef struct ScalarArrayOpExpr
} ScalarArrayOpExpr;
/*
- * BoolExpr - expression node for the basic Boolean operators AND, OR, NOT+ * BoolExpr - expression node for the basic Boolean operators AND, OR, NOT,+ * and IMPLIES
*
* Notice the arguments are given as a List. For NOT, of course the list
* must always have exactly one element. For AND and OR, there can be two
- * or more arguments.+ * or more arguments. For IMPLIES, the list must always have exactly two+ * elements.+ *+ * The planner replaces IMPLIES with the equivalent NOT and OR during+ * expression preprocessing, so execution never sees an IMPLIES_EXPR.
*/
typedef enum BoolExprType
{
- AND_EXPR, OR_EXPR, NOT_EXPR+ AND_EXPR, OR_EXPR, NOT_EXPR, IMPLIES_EXPR
} BoolExprType;
typedef struct BoolExpr
diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.hindex 53ae96c0399..94d2aef1bb1 100644--- a/src/include/parser/kwlist.h+++ b/src/include/parser/kwlist.h@@ -207,6 +207,7 @@ PG_KEYWORD("ilike", ILIKE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
PG_KEYWORD("immediate", IMMEDIATE, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("immutable", IMMUTABLE, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("implicit", IMPLICIT_P, UNRESERVED_KEYWORD, BARE_LABEL)
+PG_KEYWORD("implies", IMPLIES, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("import", IMPORT_P, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("in", IN_P, RESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("include", INCLUDE, UNRESERVED_KEYWORD, BARE_LABEL)
diff --git a/src/test/regress/expected/boolean.out b/src/test/regress/expected/boolean.outindex 0e99eb7ffc0..43c65151a1d 100644--- a/src/test/regress/expected/boolean.out+++ b/src/test/regress/expected/boolean.out@@ -566,6 +566,67 @@ SELECT isnul OR istrue OR isfalse FROM booltbl4;
t
(1 row)
+-- IMPLIES expression need to return null if there's any nulls, the+-- left value is not false, and the right value is not true+SELECT istrue IMPLIES isnul FROM booltbl4;+ ?column? +----------+ (null)+(1 row)++SELECT isnul IMPLIES isfalse FROM booltbl4;+ ?column? +----------+ (null)+(1 row)++SELECT isnul IMPLIES isnul FROM booltbl4;+ ?column? +----------+ (null)+(1 row)++SELECT istrue IMPLIES istrue FROM booltbl4;+ ?column? +----------+ t+(1 row)++SELECT istrue IMPLIES isfalse FROM booltbl4;+ ?column? +----------+ f+(1 row)++SELECT isfalse IMPLIES istrue FROM booltbl4;+ ?column? +----------+ t+(1 row)++SELECT isfalse IMPLIES isfalse FROM booltbl4;+ ?column? +----------+ t+(1 row)++SELECT isfalse IMPLIES isnul FROM booltbl4;+ ?column? +----------+ t+(1 row)++SELECT isnul IMPLIES istrue FROM booltbl4;+ ?column? +----------+ t+(1 row)++-- IMPLIES is non-associative+SELECT istrue IMPLIES istrue IMPLIES istrue AS error FROM booltbl4;+ERROR: syntax error at or near "IMPLIES"+LINE 1: SELECT istrue IMPLIES istrue IMPLIES istrue AS error FROM bo...+ ^
-- Casts
SELECT 0::boolean;
bool
diff --git a/src/test/regress/expected/create_view.out b/src/test/regress/expected/create_view.outindex c2892dfb6d0..cfbf9f4e725 100644--- a/src/test/regress/expected/create_view.out+++ b/src/test/regress/expected/create_view.out@@ -2257,7 +2257,9 @@ select x + y + z as c1,
(x,y) <= ANY (values(1,2),(3,4)) as c11,
(x>0 OR y>0) IN (SELECT false) AS c12,
(x < y) <> ALL (SELECT false) AS c13,
- true = (y = ANY (SELECT 1)) AS c14+ true = (y = ANY (SELECT 1)) AS c14,+ (x > y OR y > z) IMPLIES NOT (x > z) AS c15,+ NOT (x > y IMPLIES y > z) IMPLIES (x > z) AS c16
from (values(1,2,3)) v(x,y,z);
select pg_get_viewdef('tt26v', true);
pg_get_viewdef
@@ -2275,7 +2277,9 @@ select pg_get_viewdef('tt26v', true);
((x, y) <= ANY ( VALUES (1,2), (3,4))) AS c11,+
((x > 0 OR y > 0) IN ( SELECT false)) AS c12, +
((x < y) <> ALL ( SELECT false)) AS c13, +
- true = ((y IN ( SELECT 1))) AS c14 ++ true = ((y IN ( SELECT 1))) AS c14, ++ x > y OR y > z IMPLIES NOT x > z AS c15, ++ NOT (x > y IMPLIES y > z) IMPLIES x > z AS c16+
FROM ( VALUES (1,2,3)) v(x, y, z);
(1 row)
diff --git a/src/test/regress/sql/boolean.sql b/src/test/regress/sql/boolean.sqlindex 85c6b019882..5a5764a0312 100644--- a/src/test/regress/sql/boolean.sql+++ b/src/test/regress/sql/boolean.sql@@ -250,6 +250,21 @@ SELECT isfalse OR isnul OR istrue FROM booltbl4;
SELECT istrue OR isfalse OR isnul FROM booltbl4;
SELECT isnul OR istrue OR isfalse FROM booltbl4;
+-- IMPLIES expression need to return null if there's any nulls, the+-- left value is not false, and the right value is not true+SELECT istrue IMPLIES isnul FROM booltbl4;+SELECT isnul IMPLIES isfalse FROM booltbl4;+SELECT isnul IMPLIES isnul FROM booltbl4;+SELECT istrue IMPLIES istrue FROM booltbl4;+SELECT istrue IMPLIES isfalse FROM booltbl4;+SELECT isfalse IMPLIES istrue FROM booltbl4;+SELECT isfalse IMPLIES isfalse FROM booltbl4;+SELECT isfalse IMPLIES isnul FROM booltbl4;+SELECT isnul IMPLIES istrue FROM booltbl4;++-- IMPLIES is non-associative+SELECT istrue IMPLIES istrue IMPLIES istrue AS error FROM booltbl4;+
-- Casts
SELECT 0::boolean;
SELECT 1::boolean;
diff --git a/src/test/regress/sql/create_view.sql b/src/test/regress/sql/create_view.sqlindex f80b9823f00..8eda33f45c6 100644--- a/src/test/regress/sql/create_view.sql+++ b/src/test/regress/sql/create_view.sql@@ -829,7 +829,9 @@ select x + y + z as c1,
(x,y) <= ANY (values(1,2),(3,4)) as c11,
(x>0 OR y>0) IN (SELECT false) AS c12,
(x < y) <> ALL (SELECT false) AS c13,
- true = (y = ANY (SELECT 1)) AS c14+ true = (y = ANY (SELECT 1)) AS c14,+ (x > y OR y > z) IMPLIES NOT (x > z) AS c15,+ NOT (x > y IMPLIES y > z) IMPLIES (x > z) AS c16
from (values(1,2,3)) v(x,y,z);
select pg_get_viewdef('tt26v', true);
--
2.55.0
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, vik@postgresfriends.org, zsolt.parragi@percona.com, jacob.champion@enterprisedb.com, isaac.morland@gmail.com
Subject: Re: Logical Implication
In-Reply-To: <av4j6LHrlJjI-Bs6@nathan>
References: <arU0qXcp3KSj7M-g@nathan> <9ab35dbb-d9a4-4c1e-bae2-7763ddeb720c@postgresfriends.org> <CAN4CZFPUmkNyYP=MJbCE3OC21-De9AYhJXOD_wd8Q06E6xBzqQ@mail.gmail.com> <3d779ee0-6596-4dae-b79c-e35b237f83bf@postgresfriends.org> <ar0mGmQQz6vI6pts@nathan> <b70aba34-e799-4c09-aa3e-281a335ebf2f@postgresfriends.org> <asU7s4y_QzU7yJVZ@nathan> <au4zAwo3wQ-KfOh-@nathan> <avIyDcgAN1YufY1U@nathan> <avzS-AuYzYKzhxL1@nathan> <av4j6LHrlJjI-Bs6@nathan>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox