Re: pg_subscription.subslotname is wrongly marked NOT NULL

2020-07-21 Thread Tom Lane
I wrote: > * On the other side of the ledger, if we don't fix these markings > we cannot back-patch the additional assertions I proposed at [1]. > I'm kind of leaning to committing this as shown and back-patching > the patch at [1], but certainly a case could be made in the other > direction. Tho

Re: pg_subscription.subslotname is wrongly marked NOT NULL

2020-07-20 Thread Tom Lane
Mopping this up ... the attached patch against v12 shows the portions of 72eab84a5 and 0fa0b487b that I'm thinking of putting into v10-v12. The doc changes, which just clarify that subslotname and srsublsn can be null, should be uncontroversial. The changes in pg_subscription.c prevent it from ac

Re: pg_subscription.subslotname is wrongly marked NOT NULL

2020-07-19 Thread Tom Lane
I wrote: > pg_subscription_rel.srsublsn also needs to be marked nullable. Not only is it wrongly marked attnotnull, but two of the three places that read it are doing so unsafely (ie, as though it *were* non-nullable). So I think we'd better fix it as attached. regards, t

Re: pg_subscription.subslotname is wrongly marked NOT NULL

2020-07-19 Thread Tom Lane
I wrote: >> It's also a bit annoying that we have no mechanized checks that >> would catch this inconsistency. If JIT is going to be absolutely >> dependent on NOT NULL markings being accurate, we can't really >> have such a laissez-faire attitude to C code getting it wrong. > It seems like at le

Re: pg_subscription.subslotname is wrongly marked NOT NULL

2020-07-19 Thread Tom Lane
I wrote: > (2) In pre-v13 branches, hack the JIT tuple deconstruction code > to be specifically aware that it can't trust attnotnull for > pg_subscription.subslotname. Yeah, it's ugly, but at least it's > not ugly going forwards. Concretely, as attached for v12. regards,

Re: pg_subscription.subslotname is wrongly marked NOT NULL

2020-07-18 Thread Tom Lane
I wrote: > In all branches back to v10, initdb marks pg_subscription.subslotname > as NOT NULL: ... > Nonetheless, CREATE/ALTER SUBSCRIPTION blithely set it to null > when slot_name = NONE is specified. > What would we like to do about this? Removing the NOT NULL > marking wouldn't be too hard in