From: | Stepan Neretin <slpmcf(at)gmail(dot)com> |
---|---|
To: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Fixes a trivial bug in dumped parse/query/plan trees |
Date: | 2025-08-25 03:20:19 |
Message-ID: | CA+Yyo5SADqvKzD-5ppYNFE+DMC5fFxVo4=Y9FBDQqkJFrEUhMA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Aug 25, 2025 at 7:55 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
> Hi Hackers,
>
> This patch fixes a trivial bug where an extra whitespace was added
> when dumping an array, for example:
>
> ```
> :sort.numCols 2
> :sort.sortColIdx ( 1 4)
> :sort.sortOperators ( 97 1754)
> :sort.collations ( 0 0)
> :sort.nullsFirst ( false false)
> ```
>
> The unnecessary whitespace is now removed.
>
> Regard regards,
> --
> Chao Li (Evan)
> HighGo Software Co., Ltd.
> https://www.highgo.com/
>
>
>
>
Hi Chao,
I was able to reproduce the problem using a small test:
```sql
SET debug_print_parse = on;
CREATE TABLE test_sort_example (
id SERIAL PRIMARY KEY,
col1 INT,
col2 TEXT,
col3 TEXT
);
INSERT INTO test_sort_example (col1, col2, col3) VALUES
(1, 'apple', 'zebra'),
(2, 'banana', 'yak'),
(3, 'cherry', 'xylophone'),
(4, 'date', 'wolf');
SELECT * FROM test_sort_example
ORDER BY col2 ASC, col3 ASC;
```
The extra whitespace in the array dump (e.g.,
```
:sort.numCols 2
:sort.sortColIdx ( 1 4)
:sort.sortOperators ( 97 1754)
:sort.collations ( 0 0)
:sort.nullsFirst ( false false)
```
) was indeed present before the patch.
After applying your patch, the issue is fixed, and the array is now dumped
correctly without extra spaces. The patch looks good to me.
Regarding testing: for this case, a Perl test might actually be more
suitable than SQL tests, because OIDs can change between runs and Perl
tests allow for better control and normalization of such values.
Best regards,
Stepan Neretin
From | Date | Subject | |
---|---|---|---|
Next Message | Chao Li | 2025-08-25 03:57:51 | Re: disallow alter individual column if partition key contains wholerow reference |
Previous Message | jian he | 2025-08-25 02:57:50 | Re: bug: virtual generated column can be partition key |