Re: Re: proposal: schema variables
jian he <jian.universality@gmail.com>
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Move WAL sequence code into its own file
- a87987cafca6 19 (unreleased) cited
-
Add ExplainState argument to pg_plan_query() and planner().
- c83ac02ec730 19 (unreleased) cited
-
Don't include access/htup_details.h in executor/tuptable.h
- 1a8b5b11e48a 19 (unreleased) cited
-
Refactor to avoid code duplication in transformPLAssignStmt.
- b0fb2c6aa5a4 19 (unreleased) cited
-
Avoid including commands/dbcommands.h in so many places
- 325fc0ab14d1 19 (unreleased) cited
-
Restrict psql meta-commands in plain-text dumps.
- 71ea0d679543 19 (unreleased) cited
-
Split func.sgml into more manageable pieces
- 4e23c9ef65ac 19 (unreleased) cited
-
Fix squashing algorithm for query texts
- 0f65f3eec478 18.0 cited
-
EXPLAIN: Always use two fractional digits for row counts.
- 95dbd827f2ed 18.0 cited
-
Preliminary refactoring of plpgsql expression construction.
- a654af21ae52 18.0 cited
-
plpgsql: pure parser and reentrant scanner
- 7b27f5fd36cb 18.0 cited
-
Add some sanity checks in executor for query ID reporting
- 24f520594809 18.0 cited
-
Fix misleading error message context
- 4af123ad45bd 18.0 cited
-
Add macros for looping through a List without a ListCell.
- 14dd0f27d7cd 17.0 cited
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.