Hi Hackers, While reviewing Json Simplified Accessor Support [1], I noticed that with the new accessor, it will show the actual json field name, for example: ``` evantest=# select (j).b.c from ttt; c ----
20
(2 rows)
```
"c" is the last segment of the accessor, so the column name shows as "c".
While now "->" and "->" operators will show "?column?" as column names when
accessing Json fields. It had been my concern for many years when I was a
PG user. Now as I started to work on PG itself, I want to change that.
With this PoC patch, it will also use the last segment of an accessor path
as field name:
```
evantest=# select j->'b'->'c' from ttt;
c
----
20
(2 rows)
evantest=# select j#>array['b','c'] from ttt;
c
----
20
(2 rows)
```
But this patch has not handled case of:
```
evantest=# select j#>'{b,c}' from ttt;
?column?
----------
20
(2 rows)
```
Because I don't find an existing function to parse '{b,c}' to an array as
it is the parse phase, array_int() is not usable.
This patch is not ready for review, code is not polished, tests are not
updated. I just want to throw out the idea first to see any interest and
objection.
[1]
https://www.postgresql.org/message-id/CAK98qZ1JNNAx4QneJG%2BeX7iLesOhd6A68FNQVvvHP6Up_THf3A%40mail.gmail.com
Best regards,
Chao Li (Evan)
---------------------
HighGo Software Co., Ltd.
https://www.highgo.com/
v1-0001-PoC-Show-JSON-field-name-as-it-is-instead-of-colu.patch
Description: Binary data
