From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Julien Rouhaud <rjuju123(at)gmail(dot)com> |
Cc: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Erik Rijkers <er(at)xs4all(dot)nl>, Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, dean(dot)a(dot)rasheed(at)gmail(dot)com, joel(at)compiler(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Schema variables - new implementation for Postgres 15 (typo) |
Date: | 2023-01-10 19:35:16 |
Message-ID: | CAFj8pRAUAHr7uNwdvTsx95TSLN9brA0C+69ms0kYyKxaKHTFBg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
út 10. 1. 2023 v 3:20 odesílatel Julien Rouhaud <rjuju123(at)gmail(dot)com> napsal:
> Hi,
>
> On Sat, Jan 07, 2023 at 08:09:27AM +0100, Pavel Stehule wrote:
> > >
> > > Hmm, how safe is it for third-party code to access the stored data
> directly
> > > rather than a copy? If it makes extension fragile if they're not
> careful
> > > enough with cache invalidation, or even give them a way to mess up
> with the
> > > data directly, it's probably not a good idea to provide such an API.
> > >
> >
> > ok, I removed it
>
> Another new behavior I see is the new rowtype_only parameter for
> LookupVariable. Has this been discussed?
>
I think so it was discussed about table shadowing
without this filter, I lost the message "missing FROM-clause entry for ..."
-- should fail
SELECT varx.xxx;
-ERROR: missing FROM-clause entry for table "varx"
-LINE 1: SELECT varx.xxx;
- ^
+ERROR: type text is not composite
-- don't allow multi column query
CREATE TYPE vartesttp AS (a1 int, b1 int, c1 int);
CREATE VARIABLE v1 AS vartesttp;
@@ -1421,9 +1419,7 @@
DROP TYPE ab;
CREATE VARIABLE myvar AS int;
SELECT myvar.blabla;
-ERROR: missing FROM-clause entry for table "myvar"
-LINE 1: SELECT myvar.blabla;
- ^
+ERROR: type integer is not composite
DROP VARIABLE myvar;
-- the result of view should be same in parallel mode too
CREATE VARIABLE v1 AS int;
My original idea was to try to reduce possible conflicts (in old versions
of this path, a conflict was disallowed). But it is true, so these "new"
error messages are sensible too, and with eliminating rowtype_only I can
reduce code.
> I can see how it can be annoying to get a "variable isn't composite" type
> of
> error when you already know that only a composite object can be used (and
> other
> might work), but it looks really scary to entirely ignore some objects that
> should be found in your search_path just because of their datatype.
>
> And if we ignore something like "a.b" if "a" isn't a variable of composite
> type, why wouldn't we apply the same "just ignore it" rule if it's indeed a
> composite type but doesn't have any "b" field? Your application could also
> start to use different object if your drop a say json variable and create a
> composite variable instead.
>
> It seems to be in contradiction with how the rest of the system works and
> looks
> wrong to me. Note also that LookupVariable can be quite expensive since
> you
> may have to do a lookup for every schema found in the search_path, so the
> sooner it stops the better.
>
I removed this filter
>
> > > > updated patches attached
>
> I forgot to mention it last time but you should bump the copyright year
> for all
> new files added when you'll send a new version of the patchset.
>
fixed
I modified the IdentifyVariable function a little bit. With new argument
noerror I am able to ensure so no error will be raised when this function
is called just for shadowing detection.
Regards
Pavel
Attachment | Content-Type | Size |
---|---|---|
v20230110-1-0010-documentation.patch | text/x-patch | 43.7 KB |
v20230110-1-0007-possibility-to-dump-session-variables-by-pg_dump.patch | text/x-patch | 19.5 KB |
v20230110-1-0006-enhancing-psql-for-session-variables.patch | text/x-patch | 14.1 KB |
v20230110-1-0008-regress-tests-for-session-variables.patch | text/x-patch | 60.3 KB |
v20230110-1-0009-this-patch-changes-error-message-column-doesn-t-exis.patch | text/x-patch | 26.0 KB |
v20230110-1-0005-DISCARD-VARIABLES-command.patch | text/x-patch | 3.2 KB |
v20230110-1-0004-support-of-LET-command-in-PLpgSQL.patch | text/x-patch | 11.9 KB |
v20230110-1-0003-LET-command.patch | text/x-patch | 44.9 KB |
v20230110-1-0002-session-variables.patch | text/x-patch | 111.5 KB |
v20230110-1-0001-catalog-support-for-session-variables.patch | text/x-patch | 88.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Jacob Champion | 2023-01-10 19:36:12 | Re: RFC: logical publication via inheritance root? |
Previous Message | Andres Freund | 2023-01-10 19:34:57 | Re: Show various offset arrays for heap WAL records |