Unable parse a comment in gram.y

Started by Tatsuo Ishiiover 1 year ago8 messages
#1Tatsuo Ishii
ishii@sraoss.co.jp

I was unable to parse a comment in src/backend/parser/gram.y around line 11364:

/*
* As func_expr but does not accept WINDOW functions directly (they
* can still be contained in arguments for functions etc.)
* Use this when window expressions are not allowed, so to disambiguate
* the grammar. (e.g. in CREATE INDEX)
*/

Maybe "but" is unnecessary in the first sentence in the comment?

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Tatsuo Ishii (#1)
Re: Unable parse a comment in gram.y

On Sat, Jun 22, 2024 at 9:02 PM Tatsuo Ishii <ishii@sraoss.co.jp> wrote:

I was unable to parse a comment in src/backend/parser/gram.y around line
11364:

/*
* As func_expr but does not accept WINDOW functions directly (they
* can still be contained in arguments for functions etc.)
* Use this when window expressions are not allowed, so to disambiguate
* the grammar. (e.g. in CREATE INDEX)
*/

Maybe "but" is unnecessary in the first sentence in the comment?

The "but" is required, add a comma before it. It could also be written a
bit more verbosely:

func_expr_windowless is the same as func_expr aside from not accepting
window functions directly ...

David J.

#3Tatsuo Ishii
ishii@sraoss.co.jp
In reply to: Tatsuo Ishii (#1)
Re: Unable parse a comment in gram.y

On Sat, Jun 22, 2024 at 9:02 PM Tatsuo Ishii <ishii@sraoss.co.jp> wrote:

I was unable to parse a comment in src/backend/parser/gram.y around line
11364:

/*
* As func_expr but does not accept WINDOW functions directly (they
* can still be contained in arguments for functions etc.)
* Use this when window expressions are not allowed, so to disambiguate
* the grammar. (e.g. in CREATE INDEX)
*/

Maybe "but" is unnecessary in the first sentence in the comment?

The "but" is required, add a comma before it. It could also be written a
bit more verbosely:

func_expr_windowless is the same as func_expr aside from not accepting
window functions directly ...

Oh, I see.
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: David G. Johnston (#2)
Re: Unable parse a comment in gram.y

"David G. Johnston" <david.g.johnston@gmail.com> writes:

On Sat, Jun 22, 2024 at 9:02 PM Tatsuo Ishii <ishii@sraoss.co.jp> wrote:

I was unable to parse a comment in src/backend/parser/gram.y around line
11364:

* As func_expr but does not accept WINDOW functions directly (they
* can still be contained in arguments for functions etc.)

The "but" is required, add a comma before it. It could also be written a
bit more verbosely:

Perhaps s/As func_expr/Like func_expr/ would be less confusing?

regards, tom lane

#5Tatsuo Ishii
ishii@sraoss.co.jp
In reply to: Tatsuo Ishii (#1)
Re: Unable parse a comment in gram.y

* As func_expr but does not accept WINDOW functions directly (they
* can still be contained in arguments for functions etc.)

The "but" is required, add a comma before it. It could also be written a
bit more verbosely:

Perhaps s/As func_expr/Like func_expr/ would be less confusing?

+1. It's easier to understand at least for me.

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp

#6David G. Johnston
david.g.johnston@gmail.com
In reply to: Tatsuo Ishii (#5)
Re: Unable parse a comment in gram.y

On Saturday, June 22, 2024, Tatsuo Ishii <ishii@sraoss.co.jp> wrote:

* As func_expr but does not accept WINDOW functions directly (they
* can still be contained in arguments for functions etc.)

The "but" is required, add a comma before it. It could also be written

a

bit more verbosely:

Perhaps s/As func_expr/Like func_expr/ would be less confusing?

+1. It's easier to understand at least for me.

+1

David J.

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: David G. Johnston (#6)
1 attachment(s)
Re: Unable parse a comment in gram.y

"David G. Johnston" <david.g.johnston@gmail.com> writes:

On Saturday, June 22, 2024, Tatsuo Ishii <ishii@sraoss.co.jp> wrote:

Perhaps s/As func_expr/Like func_expr/ would be less confusing?

+1. It's easier to understand at least for me.

+1

OK. I looked through the rest of src/backend/parser/ and couldn't
find any other similar wording. There's plenty of "As with ..."
and "As in ...", but at least to me those don't seem confusing.
I'll plan to push the attached after the release freeze lifts.

regards, tom lane

Attachments:

improve-comment-in-gram.y.patchtext/x-diff; charset=us-ascii; name=improve-comment-in-gram.y.patchDownload
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 4d582950b7..4a4b47ca50 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -15667,7 +15667,7 @@ func_expr: func_application within_group_clause filter_clause over_clause
 		;
 
 /*
- * As func_expr but does not accept WINDOW functions directly
+ * Like func_expr but does not accept WINDOW functions directly
  * (but they can still be contained in arguments for functions etc).
  * Use this when window expressions are not allowed, where needed to
  * disambiguate the grammar (e.g. in CREATE INDEX).
#8Tatsuo Ishii
ishii@sraoss.co.jp
In reply to: Tatsuo Ishii (#5)
Re: Unable parse a comment in gram.y

+1. It's easier to understand at least for me.

+1

OK. I looked through the rest of src/backend/parser/ and couldn't
find any other similar wording. There's plenty of "As with ..."
and "As in ...", but at least to me those don't seem confusing.
I'll plan to push the attached after the release freeze lifts.

Excellent!
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp