public inbox for [email protected]
help / color / mirror / Atom feedFrom: Zhang Mingli <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: useless LIMIT_OPTION_DEFAULT
Date: Thu, 14 Dec 2023 09:17:33 +0800
Message-ID: <59d61a1a-3858-475a-964f-24468c97cc67@Spark> (raw)
In-Reply-To: <b4f097ce-6422-49d7-888a-2e0a7a18f5f2@Spark>
References: <b4f097ce-6422-49d7-888a-2e0a7a18f5f2@Spark>
Hi, all
By reading the codes, I found that we process limit option as LIMIT_OPTION_WITH_TIES when using WITH TIES
and all others are LIMIT_OPTION_COUNT by commit 357889eb17bb9c9336c4f324ceb1651da616fe57.
And check actual limit node in limit_needed().
There is no need to maintain a useless default limit enum.
I remove it and have an install check to verify.
Are there any considerations behind this?
Shall we remove it for clear as it’s not actually the default option.
Zhang Mingli
www.hashdata.xyz
Attachments:
[application/octet-stream] v1-0001-Remove-useless-LIMIT_OPTION_DEFAULT.patch (1.6K, ../59d61a1a-3858-475a-964f-24468c97cc67@Spark/3-v1-0001-Remove-useless-LIMIT_OPTION_DEFAULT.patch)
download | inline diff:
From 81e8224d6853ec9b603d622f29d95c0e4e3e7aac Mon Sep 17 00:00:00 2001
From: Zhang Mingli <[email protected]>
Date: Thu, 14 Dec 2023 08:58:05 +0800
Subject: [PATCH] Remove useless LIMIT_OPTION_DEFAULT.
We process limit option as LIMIT_OPTION_WITH_TIES when using WITH TIES.
All others are LIMIT_OPTION_COUNT.
And check actual limit node in limit_needed().
There is no need to maintain a useless default limit enum.
Authored-by: Zhang Mingli [email protected]
---
src/backend/parser/gram.y | 2 +-
src/include/nodes/nodes.h | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index f16bbd3cdd..63f172e175 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -18461,7 +18461,7 @@ insertSelectOptions(SelectStmt *stmt,
parser_errposition(exprLocation(limitClause->limitCount))));
stmt->limitCount = limitClause->limitCount;
}
- if (limitClause && limitClause->limitOption != LIMIT_OPTION_DEFAULT)
+ if (limitClause)
{
if (stmt->limitOption)
ereport(ERROR,
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index 4c32682e4c..6e776a8aa6 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -439,8 +439,7 @@ typedef enum OnConflictAction
typedef enum LimitOption
{
LIMIT_OPTION_COUNT, /* FETCH FIRST... ONLY */
- LIMIT_OPTION_WITH_TIES, /* FETCH FIRST... WITH TIES */
- LIMIT_OPTION_DEFAULT, /* No limit present */
+ LIMIT_OPTION_WITH_TIES /* FETCH FIRST... WITH TIES */
} LimitOption;
#endif /* NODES_H */
--
2.34.1
view thread (2+ messages)
reply
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: useless LIMIT_OPTION_DEFAULT
In-Reply-To: <59d61a1a-3858-475a-964f-24468c97cc67@Spark>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox