Re: NAMEDATALEN increase because of non-latin languages - Mailing list pgsql-hackers
| From | Robert Haas |
|---|---|
| Subject | Re: NAMEDATALEN increase because of non-latin languages |
| Date | |
| Msg-id | CA+TgmoZFV4KgB53ArE=AHY2s6X4Cp8VuXHLRW7GrDtD05=+5dA@mail.gmail.com Whole thread Raw |
| In response to | Re: NAMEDATALEN increase because of non-latin languages (Julien Rouhaud <rjuju123@gmail.com>) |
| Responses |
Re: NAMEDATALEN increase because of non-latin languages
|
| List | pgsql-hackers |
On Thu, Jun 23, 2022 at 6:13 AM Julien Rouhaud <rjuju123@gmail.com> wrote:
> While some problem wouldn't happen if we restricted the feature to system
> catalogs only (e.g. with renamed / dropped attributes, inheritance...), a lot
> would still exist and would have to be dealt with initially. However I'm not
> sure what behavior would be wanted or acceptable, especially if we want
> something that can eventually be used for user relations too, with possibly
> dynamic positions.
I am not very convinced that this would make the project a whole lot
easier, but it does seem like the result would be less nice.
> I'll describe some of those problems, and just to make things easier I will use
> a normal table "ab" with 2 attributes, a and b, with their physical / logical
> position reversed.
>
> Obviously
>
> SELECT * FROM ab
>
> should return a and b in that order. The aliases should also probably match
> the logical position, as in:
>
> SELECT * FROM ab ab(aa, bb)
>
> should probably map aa to a and bb to b.
Check.
> But should COPY FROM / COPY TO / INSERT INTO use the logical position too if
> not column list is provided? I'd think so, but it goes further from the
> original "only handle star expansion" idea.
I think yes.
> And should record_in / record_out use the logical position, as in:
> SELECT ab::text FROM ab / SELECT (a, b)::ab;
>
> I would think not, as relying on a possibly dynamic order could break things if
> you store the results somewhere, but YMMV.
I think here the answer is yes again. I mean, consider that you could
also ALTER TABLE DROP COLUMN and then ALTER TABLE ADD COLUMN with the
same name. That is surely going to affect the meaning of such things.
I don't think we want to have one meaning if you reorder things that
way and a different meaning if you reorder things using whatever
commands we create for changing the display column positions.
> Note that there a variations of that, like
> SELECT ab::ab FROM (SELECT * FROM ab) ab;
>
> But those should probably work as intended (for now it doesn't) as you can't
> store a bare record, and storing a plain "ab" type wouldn't be problematic with
> dynamic changes.
If the sub-SELECT and the cast both use the display order, which I
think they should, then there's no problem here, I believe.
> Then, what about joinrels expansion? I learned that the column ordering rules
> are far from being obvious, and I didn't find those in the documentation (note
> that I don't know if that something actually described in the SQL standard).
> So for instance, if a join is using an explicit USING clause rather than an ON
> clause, the merged columns are expanded first, so:
>
> SELECT * FROM ab ab1 JOIN ab ab2 USING (b)
>
> should unexpectedly expand to (b, a, a). Is this order a strict requirement?
I dunno, but I can't see why it creates a problem for this patch to
maintain the current behavior. I mean, just use the logical column
position instead of the physical one here and forget about the details
of how it works beyond that.
> Another problem (that probably wouldn't be a problem for system catalogs) is
> that defaults are evaluated in the physical position. This example from the
> regression test will clearly have a different behavior if the columns are in a
> different physical order:
>
> CREATE TABLE INSERT_TBL (
> x INT DEFAULT nextval('insert_seq'),
> y TEXT DEFAULT '-NULL-',
> z INT DEFAULT -1 * currval('insert_seq'),
> CONSTRAINT INSERT_TBL_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8),
> CHECK (x + z = 0));
>
> But changing the behavior to rely on the logical position seems quite
> dangerous.
Why?
--
Robert Haas
EDB: http://www.enterprisedb.com
pgsql-hackers by date: