From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Erik Rijkers <er(at)xs4all(dot)nl>, Michael Paquier <michael(at)paquier(dot)xyz>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, DUVAL REMI <REMI(dot)DUVAL(at)cheops(dot)fr>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Re: proposal: schema variables |
Date: | 2025-02-06 14:49:00 |
Message-ID: | CACJufxH2M-tAXTqpttS=f96xfAqj3jVO1BxworB+jyrujR=PPA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-performance |
hi.
git diff --check
shows there is some white space there.
Adding hack mailing list discussion links in each patch would be great.
Others said that the first 6 patches are essential, maybe we can only
post the first 6 patches.
so the test CI result would be more reliable. also people would not
feel intimidated by
the bigger patchset.
create domain dnn as int not null;
CREATE VARIABLE var3 AS dnn;
alter domain dnn drop not null;
alter domain dnn set not null;
ERROR: cannot alter domain "dnn" because session variable "public.var3" uses it
This is not great.
we allow a constraint, then we drop it, now we cannot re add it again.
0001 and 0002 are simple, but the size is still large.
maybe we can not support the domain in the first 2 patches.
also
CREATE VARIABLE var3 AS dnn;
let var3 = 11;
create view v1 as select var3;
select * from v1;
you can see reconnect to session then
ERROR: domain dnn does not allow null values
this is not ok?
also
create table t(var3 int);
CREATE POLICY p1r ON t AS RESTRICTIVE TO alice USING (var3 <> var3);
create table t1(a int);
CREATE POLICY p2 ON t1 AS RESTRICTIVE TO alice USING (a <> var3);
p1r is so confusing. there is no way to understand the intention.
p2 should also not be allowed, since var3 value is volatile,
session reconnection will change the value.
src/bin/pg_dump/pg_dump.h
/*
* The VariableInfo struct is used to represent session variables
*/
typedef struct _VariableInfo
{
DumpableObject dobj;
DumpableAcl dacl;
Oid vartype;
char *vartypname;
char *varacl;
char *rvaracl;
char *initvaracl;
char *initrvaracl;
Oid varcollation;
const char *rolname; /* name of owner, or empty string */
} VariableInfo;
these fields (varacl, rvaracl, initvaracl, initrvaracl) were never being used.
we can remove them.
CollInfo *coll;
coll = findCollationByOid(varcollation);
if (coll)
appendPQExpBuffer(query, " COLLATE %s",
fmtQualifiedDumpable(coll));
here, it should be
```CollInfo *coll = NULL;```?
I don't understand the changes made in getAdditionalACLs.
I thought pg_init_privs had nothing to do with the session variable.
minor issue in getVariables.
query = createPQExpBuffer();
resetPQExpBuffer(query);
no need to use resetPQExpBuffer here.
create type ab as (a int, b text);
create type abc as (a ab, c text);
create type abcd as (a abc, d text);
CREATE VARIABLE var2 AS abcd;
select var2.a.c;
ERROR: cross-database references are not implemented: var2.a.c
Is this error what we expected? I am not 100% sure.
--------------------another contrived corner case.-----------------------
create type pg_variable as (
oid oid, vartype oid, varcreate_lsn pg_lsn,
varname name, varnamespace oid, varowner oid,
vartypmod int, varcollation oid, varacl aclitem[]);
create variable pg_variable as pg_variable;
let pg_variable = row (18041, 10116, '0/25137B0','pg_variable', 2200,
10,-1,0, NULL)::pg_variable;
select pg_variable.oid from pg_variable where pg_variable.oid = pg_variable.oid;
this query, the WHERE clause, it's really hard to distinguish session
variable or column reference.
I am not sure if this is fine or not.
From | Date | Subject | |
---|---|---|---|
Next Message | Junwang Zhao | 2025-02-06 14:52:32 | Re: SQL Property Graph Queries (SQL/PGQ) |
Previous Message | David G. Johnston | 2025-02-06 14:43:17 | Re: Docs for pg_basebackup needs v17 note for incremental backup |
From | Date | Subject | |
---|---|---|---|
Previous Message | Laurenz Albe | 2025-02-03 15:59:21 | Re: Performance loss after upgrading from 12.15 to 17.2 |