On 2024-Nov-08, Tom Lane wrote:
> Alvaro Herrera writes:
> > But we'll see what else the buildfarm has to say now that I pushed it ...
>
> A lot of the buildfarm is saying
>
> adder | 2024-11-08 13:04:39 |
> ../pgsql/src/backend/catalog/pg_constraint.c:708:37: warning: comparison is
Alvaro Herrera writes:
> But we'll see what else the buildfarm has to say now that I pushed it ...
A lot of the buildfarm is saying
adder | 2024-11-08 13:04:39 |
../pgsql/src/backend/catalog/pg_constraint.c:708:37: warning: comparison is
always true due to limited range of data type [
On 2024-Nov-08, jian he wrote:
> > Here's v11, which I intended to commit today, but didn't get around to.
> > CI is happy with it, so I'll probably do it tomorrow first thing.
> >
> v11 still has column_constraint versus table_constraint inconsistency.
>
> create table t7 (a int generated by def
> Here's v11, which I intended to commit today, but didn't get around to.
> CI is happy with it, so I'll probably do it tomorrow first thing.
>
v11 still has column_constraint versus table_constraint inconsistency.
create table t7 (a int generated by default as identity, constraint
foo not null a
On 2024-Nov-08, jian he wrote:
> > Here's v11, which I intended to commit today, but didn't get around to.
> > CI is happy with it, so I'll probably do it tomorrow first thing.
> >
>
> CREATE TABLE notnull_tbl2 (a INTEGER CONSTRAINT blah NOT NULL, b
> INTEGER CONSTRAINT blah NOT NULL);
>
> Relat
>
> Here's v11, which I intended to commit today, but didn't get around to.
> CI is happy with it, so I'll probably do it tomorrow first thing.
>
CREATE TABLE notnull_tbl2 (a INTEGER CONSTRAINT blah NOT NULL, b
INTEGER CONSTRAINT blah NOT NULL);
RelationGetNotNullConstraints, StoreRelNotNull
will
On 2024-Nov-07, jian he wrote:
> RemoveInheritance
> if (copy_con->coninhcount <= 0) /* shouldn't happen */
> elog(ERROR, "relation %u has non-inherited constraint \"%s\"",
> RelationGetRelid(child_rel), NameStr(copy_con->conname));
> dropconstraint
RemoveInheritance
if (copy_con->coninhcount <= 0) /* shouldn't happen */
elog(ERROR, "relation %u has non-inherited constraint \"%s\"",
RelationGetRelid(child_rel), NameStr(copy_con->conname));
dropconstraint_internal
if (childcon->coninhcoun
sql-altertable.html
SET/DROP NOT NULL
These forms change whether a column is marked to allow null
values or to reject null values.
If this table is a partition, one cannot perform DROP
NOT NULL
on a column if it is marked NOT NULL in the paren
tricky case:
drop table if exists part, part0 cascade;
create table part (a int not null) partition by range (a);
create table part0 (a int primary key);
alter table part attach partition part0 for values from (0) to (1000);
alter table ONLY part add primary key(a);
alter table ONLY part drop const
I did some refactoring on transformColumnDefinition
since transformColumnDefinition only deals with a single ColumnDef.
and serial/primary/identity cannot allow not-null no inherit.
We can preliminary iterate through ColumnDef->constraints to check
that ColumnDef can allow not-null no inherit or no
On Fri, Oct 4, 2024 at 9:11 PM Alvaro Herrera wrote:
>
> Here's v8 of this patch.
in AdjustNotNullInheritance
if (count > 0)
{
conform->coninhcount += count;
changed = true;
}
if (is_local)
{
conform->conislocal = true;
On 2024-Oct-03, jian he wrote:
> I thought SearchSysCacheCopyAttNum is expensive.
> Relation->rd_att is enough for checking attnotnull.
>
> What do you think of the following refactoring of set_attnotnull?
Eh, sure, why not. I mean, I expect that this is going to be barely
noticeable performanc
I thought SearchSysCacheCopyAttNum is expensive.
Relation->rd_att is enough for checking attnotnull.
What do you think of the following refactoring of set_attnotnull?
static void
set_attnotnull(List **wqueue, Relation rel, AttrNumber attnum,
LOCKMODE lockmode)
{
Oid
On 2024-Oct-02, Alvaro Herrera wrote:
> On 2024-Oct-02, jian he wrote:
>
> > On Tue, Oct 1, 2024 at 11:20 PM Alvaro Herrera
> > wrote:
> > after v7, still not bullet-proof. as before, pg_dump/restore will fail
> > for the following:
> >
> > drop table if exists t2, t2_0
> > create table t2 (a
On 2024-Oct-02, jian he wrote:
> On Tue, Oct 1, 2024 at 11:20 PM Alvaro Herrera
> wrote:
> >
> > On 2024-Oct-01, jian he wrote:
> >
> > > create table t2 (a int primary key constraint foo not null no inherit);
> > > primary key cannot coexist with not-null no inherit?
> > > here t2, pg_dump/res
On Tue, Oct 1, 2024 at 11:20 PM Alvaro Herrera wrote:
>
> On 2024-Oct-01, jian he wrote:
>
> > create table t2 (a int primary key constraint foo not null no inherit);
> > primary key cannot coexist with not-null no inherit?
> > here t2, pg_dump/restore will fail.
>
> Yeah, this needs to throw an
CREATE TABLE a (aa TEXT);
CREATE TEMP TABLE z (b TEXT, UNIQUE(aa, b)) inherits (a);
\d+ z
Table "pg_temp_0.z"
Column | Type | Collation | Nullable | Default | Storage |
Compression | Stats target | Description
+--+---+--+--
create table t2 (a int primary key constraint foo not null no inherit);
primary key cannot coexist with not-null no inherit?
here t2, pg_dump/restore will fail.
create table t7 (a int generated by default as identity, constraint
foo not null a no inherit, b int);
create table t7 (a int generated
On 2024-Oct-01, jian he wrote:
> create table t2 (a int primary key constraint foo not null no inherit);
> primary key cannot coexist with not-null no inherit?
> here t2, pg_dump/restore will fail.
Yeah, this needs to throw an error. If you use a table constraint, it
does fail as expected:
cre
ATExecDropInherit
/*
* If the parent has a primary key, then we decrement counts for all NOT
* NULL constraints
*/
ObjectAddressSet(address, RelationRelationId,
RelationGetRelid(parent_rel));
only not-null constraint,
with ALTER TABLE NO INHERIT we still
On 2024-Sep-26, jian he wrote:
> +-- a PK in parent must have a not-null in child that it can mark inherited
> +create table inh_parent (a int primary key);
> +create table inh_child (a int primary key);
> +alter table inh_child inherit inh_parent; -- nope
> +alter table inh_child alter a set not
+-- a PK in parent must have a not-null in child that it can mark inherited
+create table inh_parent (a int primary key);
+create table inh_child (a int primary key);
+alter table inh_child inherit inh_parent; -- nope
+alter table inh_child alter a set not null;
+alter table inh_child inherit inh_p
Please check the attached minor doc changes.
make the create_foreign_table.sgml, alter_foreign_table.sgml
not-null description
consistent with normal tables.
change
doc/src/sgml/ref/create_table.sgml
Parameters section
from
NOT NULL
to
NOT NULL [ NO INHERIT ] .
in doc/src/sgml/ref/alter_table.
On 2024-Sep-25, jian he wrote:
> copy from src/test/regress/sql/index_including.sql
> -- Unique index and unique constraint
> CREATE TABLE tbl_include_unique1 (c1 int, c2 int, c3 int, c4 box);
> INSERT INTO tbl_include_unique1 SELECT x, 2*x, 3*x, box('4,4,4,4')
> FROM generate_series(1,10) AS x;
>
in ATExecSetNotNull
/*
* If we find an appropriate constraint, we're almost done, but just
* need to change some properties on it: if we're recursing, increment
* coninhcount; if not, set conislocal if not already set.
*/
if (recursing)
{
copy from src/test/regress/sql/index_including.sql
-- Unique index and unique constraint
CREATE TABLE tbl_include_unique1 (c1 int, c2 int, c3 int, c4 box);
INSERT INTO tbl_include_unique1 SELECT x, 2*x, 3*x, box('4,4,4,4')
FROM generate_series(1,10) AS x;
CREATE UNIQUE INDEX tbl_include_unique1_idx
On 2024-Sep-24, jian he wrote:
> sql-createtable.html
> SECTION: LIKE source_table [ like_option ... ]
> INCLUDING CONSTRAINTS
> CHECK constraints will be copied. No distinction is made between
> column constraints and table constraints. Not-null constraints are
> always copied to the new table.
>
On 2024-Sep-24, jian he wrote:
> static void
> set_attnotnull(List **wqueue, Relation rel, AttrNumber attnum, bool recurse,
>LOCKMODE lockmode)
> {
> What do you think of the above refactor?
> (I intentionally deleted empty new line)
Looks nicer ... but you know what? After spen
On 2024-Sep-24, jian he wrote:
> static Oid
> StoreRelNotNull(Relation rel, const char *nnname, AttrNumber attnum,
> bool is_validated, bool is_local, int inhcount,
> bool is_no_inherit)
> {
> OidconstrOid;
> Assert(attnum > InvalidAttrNumber);
>
static Oid
StoreRelNotNull(Relation rel, const char *nnname, AttrNumber attnum,
bool is_validated, bool is_local, int inhcount,
bool is_no_inherit)
{
OidconstrOid;
Assert(attnum > InvalidAttrNumber);
constrOid =
CreateConstraintEntry(n
On Fri, Sep 20, 2024 at 8:08 PM Alvaro Herrera wrote:
>
> On 2024-Sep-20, jian he wrote:
>
> > about set_attnotnull.
> >
> > we can make set_attnotnull look less recursive.
> > instead of calling find_inheritance_children,
> > let's just one pass, directly call find_all_inheritors
> > overall, I
On Sat, Sep 21, 2024 at 5:15 AM Alvaro Herrera wrote:
>
> Okay, so here is v4 with these problems fixed, including correct
> propagation of constraint names to children tables, which I had
> inadvertently broken earlier. This one does pass the pg_upgrade tests
> and as far as I can see pg_dump do
Alvaro Herrera 于2024年9月21日周六 05:15写道:
> On 2024-Sep-20, Alvaro Herrera wrote:
>
> > Yeah, there's a bunch of conflicts in current master. I rebased
> > yesterday but I'm still composing the email for v4. Coming soon.
>
> Okay, so here is v4 with these problems fixed, including correct
> propaga
On 2024-Sep-20, jian he wrote:
> about set_attnotnull.
>
> we can make set_attnotnull look less recursive.
> instead of calling find_inheritance_children,
> let's just one pass, directly call find_all_inheritors
> overall, I think it would be more intuitive.
>
> please check the attached refac
> > We only have this Synopsis
> > ALTER [ COLUMN ] column_name { SET | DROP } NOT NULL
>
> Yeah, this syntax is intended to add a "normal" not-null constraint,
> i.e. one that inherits.
>
> > --tests from src/test/regress/sql/inherit.sql
> > CREATE TABLE inh_nn_parent (a int, NOT NULL a NO INHERIT
about set_attnotnull.
we can make set_attnotnull look less recursive.
instead of calling find_inheritance_children,
let's just one pass, directly call find_all_inheritors
overall, I think it would be more intuitive.
please check the attached refactored set_attnotnull.
regress test passed, i onl
On 2024-Sep-20, Tender Wang wrote:
> By the way, the v3 failed applying on Head(d35e293878)
> git am v3-0001-Catalog-not-null-constraints.patch
> Applying: Catalog not-null constraints
> error: patch failed: doc/src/sgml/ref/create_table.sgml:77
Yeah, there's a bunch of conflicts in current mast
On 2024-Sep-20, Tender Wang wrote:
> jian he 于2024年9月20日周五 11:34写道:
>
> > another bug.
> > I will dig later, just want to share it first.
> >
> > minimum producer:
> > drop table if exists pp1,cc1, cc2,cc3;
> > create table pp1 (f1 int );
> > create table cc1 () inherits (pp1);
> > create table
By the way, the v3 failed applying on Head(d35e293878)
git am v3-0001-Catalog-not-null-constraints.patch
Applying: Catalog not-null constraints
error: patch failed: doc/src/sgml/ref/create_table.sgml:77
error: doc/src/sgml/ref/create_table.sgml: patch does not apply
error: patch failed: src/backen
jian he 于2024年9月20日周五 11:34写道:
> another bug.
> I will dig later, just want to share it first.
>
> minimum producer:
> drop table if exists pp1,cc1, cc2,cc3;
> create table pp1 (f1 int );
> create table cc1 () inherits (pp1);
> create table cc2() inherits(pp1,cc1);
> create table cc3() inherits(p
another bug.
I will dig later, just want to share it first.
minimum producer:
drop table if exists pp1,cc1, cc2,cc3;
create table pp1 (f1 int );
create table cc1 () inherits (pp1);
create table cc2() inherits(pp1,cc1);
create table cc3() inherits(pp1,cc1,cc2);
alter table pp1 alter f1 set not nul
On Thu, Sep 19, 2024 at 4:26 PM Alvaro Herrera wrote:
>
>
> > drop table if exists idxpart, idxpart0, idxpart1 cascade;
> > create table idxpart (a int) partition by range (a);
> > create table idxpart0 (a int primary key);
> > alter table idxpart attach partition idxpart0 for values from (0) to (
On 2024-Sep-19, jian he wrote:
> still based on v3.
> in src/sgml/html/ddl-partitioning.html
> << Both CHECK and NOT NULL constraints of a partitioned table are always
> inherited by all its partitions.
> CHECK constraints that are marked NO INHERIT are not allowed to be
> created on partitioned t
still based on v3.
in src/sgml/html/ddl-partitioning.html
<<
On Tue, Sep 17, 2024 at 1:47 AM Alvaro Herrera wrote:
>
still digging inheritance related issues.
drop table if exists pp1,cc1, cc2;
create table pp1 (f1 int, constraint nn check (f1 > 1));
create table cc1 (f2 text, f3 int ) inherits (pp1);
create table cc2(f4 float, constraint nn check (f1 >
On 2024-Sep-12, jian he wrote:
> ---exampleA
> drop table pp1,cc1, cc2;
> create table pp1 (f1 int);
> create table cc1 (f2 text, f3 int) inherits (pp1);
> create table cc2(f4 float) inherits(pp1,cc1);
> alter table pp1 alter column f1 set not null;
> execute constr_meta('{pp1,cc1, cc2}');
>
> --
> > On Wed, Sep 11, 2024 at 2:18 AM Alvaro Herrera
> > wrote:
> > >
> > > Hello, here's a v2 of this patch. I have fixed --I think-- all the
> > > issues you and Tender Wang reported (unless I declined a fix in some
> > > previous email).
> > >
PREPARE constr_meta (name[]) AS
with cte as
(
sele
On 2024-Sep-11, jian he wrote:
> On Wed, Sep 11, 2024 at 2:18 AM Alvaro Herrera
> wrote:
> >
> > Hello, here's a v2 of this patch. I have fixed --I think-- all the
> > issues you and Tender Wang reported (unless I declined a fix in some
> > previous email).
> >
>
> + /*
> + * The constraint mu
On Wed, Sep 11, 2024 at 9:11 AM jian he wrote:
>
> On Wed, Sep 11, 2024 at 2:18 AM Alvaro Herrera
> wrote:
> >
> > Hello, here's a v2 of this patch. I have fixed --I think-- all the
> > issues you and Tender Wang reported (unless I declined a fix in some
> > previous email).
> >
after applying
On Wed, Sep 11, 2024 at 2:18 AM Alvaro Herrera wrote:
>
> Hello, here's a v2 of this patch. I have fixed --I think-- all the
> issues you and Tender Wang reported (unless I declined a fix in some
> previous email).
>
+ /*
+ * The constraint must appear as inherited in children, so create a
+ * m
On 2024-Sep-02, Tender Wang wrote:
> The attached patch adds List *nnconstraints, which store the not-null
> definition, in struct CreateStmt. This makes me a little confused
> about List *constraints in struct CreateStmt. Actually, the List
> constraints store ckeck constraint, and it will be b
On 2024-Sep-09, jian he wrote:
> bold idea. print out the constraint name: violates not-null constraint \"%s\"
> for the following code:
> ereport(ERROR,
> (errcode(ERRCODE_NOT_NULL_VIOLATION),
> errmsg("null value in column \"%s\" o
jian he 于2024年9月9日周一 16:31写道:
> On Mon, Sep 2, 2024 at 6:33 PM Tender Wang wrote:
> >
> >
> >
> > The attached patch adds List *nnconstraints, which store the not-null
> definition, in struct CreateStmt.
> > This makes me a little confused about List *constraints in struct
> CreateStmt. Actuall
On Mon, Sep 2, 2024 at 6:33 PM Tender Wang wrote:
>
>
>
> The attached patch adds List *nnconstraints, which store the not-null
> definition, in struct CreateStmt.
> This makes me a little confused about List *constraints in struct CreateStmt.
> Actually, the List constraints
> store ckeck cons
On Sat, Aug 31, 2024 at 11:59 AM Alvaro Herrera wrote:
>
> Hello
>
> Here I present another attempt at making not-null constraints be
> catalogued. This is largely based on the code reverted at 9ce04b50e120,
> except that we now have a not-null constraint automatically created for
> every column
Alvaro Herrera 于2024年8月31日周六 11:59写道:
> Hello
>
> Here I present another attempt at making not-null constraints be
> catalogued. This is largely based on the code reverted at 9ce04b50e120,
> except that we now have a not-null constraint automatically created for
> every column of a primary key,
Alvaro Herrera 于2024年8月31日周六 11:59写道:
> Hello
>
> Here I present another attempt at making not-null constraints be
> catalogued. This is largely based on the code reverted at 9ce04b50e120,
> except that we now have a not-null constraint automatically created for
> every column of a primary key,
Alvaro Herrera 于2024年8月31日周六 11:59写道:
> Hello
>
> Here I present another attempt at making not-null constraints be
> catalogued. This is largely based on the code reverted at 9ce04b50e120,
> except that we now have a not-null constraint automatically created for
> every column of a primary key,
59 matches
Mail list logo