NOT NULL markings for BKI columns
От | Andres Freund |
---|---|
Тема | NOT NULL markings for BKI columns |
Дата | |
Msg-id | 20150215170014.GE15326@awork2.anarazel.de обсуждение исходный текст |
Ответы |
Re: NOT NULL markings for BKI columns
|
Список | pgsql-hackers |
Hi, 8b38a538c0aa5a432dacd90f10805dc667a3d1a0 changed things so that all columns are checked for NOT NULL ness. Which is fine in general, but it currently does make it impossible to have a varlena column (except OID/INT2 vector...) as a key column in syscache. Even if the column is factually NOT NUL. The rule for determining attribute's NOT NULL setting in bootstrap is:/* * Mark as "not null" if type is fixed-width andprior columns are too. * This corresponds to case where column can be accessed directly via C * struct declaration. ** oidvector and int2vector are also treated as not-nullable, even though * they are no longer fixed-width. */ #define MARKNOTNULL(att) \((att)->attlen > 0 || \ (att)->atttypid == OIDVECTOROID || \ (att)->atttypid == INT2VECTOROID) if (MARKNOTNULL(attrtypes[attnum])){ int i; for (i = 0; i < attnum; i++) { if (!MARKNOTNULL(attrtypes[i])) break; } if (i == attnum) attrtypes[attnum]->attnotnull = true;} (the rule is also encoded in genbki.pl) Now, you can argue that it's a folly to use the syscache code to access something via a text column (which is what I want to do). I don't agree, but even if you're of that position, it seems worthwhile to mark further catalog columns as NOT NULL in the catalog if that's what the code expects? E.g. pg_(sh)?seclabel.provider should certainly be NOT NULL. pg_extension.extversion as well. There's a couple more I think. So, how about providing bootstrap infrastructure for marking columns as NOT NULL? Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services
В списке pgsql-hackers по дате отправления: