Re: assert pg_class.relnatts is consistent

2020-02-16 Thread Justin Pryzby
On Mon, Feb 17, 2020 at 01:25:05PM +0900, Amit Langote wrote: > > Pushed both of those. > > Thank you. > > It's amazing to see how simple bootstrapping has now become thanks to > the work you guys have done recently. On Fri, Feb 14, 2020 at 06:00:05PM +0900, Amit Langote wrote: > > I can't

Re: assert pg_class.relnatts is consistent

2020-02-16 Thread Amit Langote
On Sun, Feb 16, 2020 at 5:25 AM Tom Lane wrote: > I wrote: > > So that leads me to the attached. > > ... > > (I agree with Alvaro's thought of shortening AddDefaultValues, > > but didn't do that here.) > > Pushed both of those. Thank you. It's amazing to see how simple bootstrapping has now

Re: assert pg_class.relnatts is consistent

2020-02-15 Thread Tom Lane
I wrote: > So that leads me to the attached. > ... > (I agree with Alvaro's thought of shortening AddDefaultValues, > but didn't do that here.) Pushed both of those. I also did something with the stale comment that Justin referred to in the initial message (it wasn't really good practice to try

Re: assert pg_class.relnatts is consistent

2020-02-14 Thread Tom Lane
Alvaro Herrera writes: > On 2020-Feb-14, John Naylor wrote: >> One possible objection to what I wrote above is that it adds a >> different kind of special case, but in a sneaky way. Perhaps it would >> be more principled to treat it the same as oid after all. If we do >> that, it would help to

Re: assert pg_class.relnatts is consistent

2020-02-14 Thread Alvaro Herrera
On 2020-Feb-14, John Naylor wrote: > One possible objection to what I wrote above is that it adds a > different kind of special case, but in a sneaky way. Perhaps it would > be more principled to treat it the same as oid after all. If we do > that, it would help to add a comment that we can't

Re: assert pg_class.relnatts is consistent

2020-02-14 Thread Alvaro Herrera
I propose this more concise coding for AddDefaultValues, # Now fill in defaults, and note any columns that remain undefined. foreach my $column (@$schema) { my $attname = $column->{name}; my $atttype = $column->{type}; #

Re: assert pg_class.relnatts is consistent

2020-02-14 Thread Amit Langote
Hi John, On Fri, Feb 14, 2020 at 6:50 PM John Naylor wrote: > On Fri, Feb 14, 2020 at 5:00 PM Amit Langote wrote: > > I tried and think it works but not sure if that's good Perl > > programming. See the attached. > > Hi Amit, > I took this for a spin -- I just have a couple comments. Thanks

Re: assert pg_class.relnatts is consistent

2020-02-14 Thread Amit Langote
On Fri, Feb 14, 2020 at 6:47 PM Michael Paquier wrote: > On Fri, Feb 14, 2020 at 06:00:05PM +0900, Amit Langote wrote: > > On Fri, Feb 14, 2020 at 2:58 PM Amit Langote > > wrote: > > > On Fri, Feb 14, 2020 at 1:04 AM Tom Lane wrote: > > > > I've been burnt by this too :-(. However, I think

Re: assert pg_class.relnatts is consistent

2020-02-14 Thread John Naylor
> pronangs, since we need more information than what's in each pg_class Sigh, and of course I met pg_proc.pronargs. -- John Naylorhttps://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: assert pg_class.relnatts is consistent

2020-02-14 Thread John Naylor
I wrote: > + elsif ($attname eq 'relnatts') > + { > + ; > + } > > With your patch, I get this when running > src/include/catalog/reformat_dat_file.pl: > > strip_default_values: pg_class.relnatts undefined > > Rather than adding this one-off case to AddDefaultValues and then > another special case

Re: assert pg_class.relnatts is consistent

2020-02-14 Thread John Naylor
On Fri, Feb 14, 2020 at 5:00 PM Amit Langote wrote: > I tried and think it works but not sure if that's good Perl > programming. See the attached. Hi Amit, I took this for a spin -- I just have a couple comments. + elsif ($attname eq 'relnatts') + { + ; + } With your patch, I get this when

Re: assert pg_class.relnatts is consistent

2020-02-14 Thread Michael Paquier
On Fri, Feb 14, 2020 at 06:00:05PM +0900, Amit Langote wrote: > On Fri, Feb 14, 2020 at 2:58 PM Amit Langote wrote: > > On Fri, Feb 14, 2020 at 1:04 AM Tom Lane wrote: > > > I've been burnt by this too :-(. However, I think this patch is > > > completely the wrong way to go about improving

Re: assert pg_class.relnatts is consistent

2020-02-14 Thread Amit Langote
On Fri, Feb 14, 2020 at 2:58 PM Amit Langote wrote: > On Fri, Feb 14, 2020 at 1:04 AM Tom Lane wrote: > > I've been burnt by this too :-(. However, I think this patch is > > completely the wrong way to go about improving this. What we should > > be doing, now that we have all that perl code

Re: assert pg_class.relnatts is consistent

2020-02-13 Thread Amit Langote
On Fri, Feb 14, 2020 at 1:04 AM Tom Lane wrote: > > Amit Langote writes: > > On Thu, Feb 13, 2020 at 4:51 PM Amit Langote > > wrote: > >> I know I have made the mistake of not updating relnatts when I added > >> relispartition, etc. to pg_class, only to be bitten by it in the form > >> of

Re: assert pg_class.relnatts is consistent

2020-02-13 Thread Tom Lane
Amit Langote writes: > On Thu, Feb 13, 2020 at 4:51 PM Amit Langote wrote: >> I know I have made the mistake of not updating relnatts when I added >> relispartition, etc. to pg_class, only to be bitten by it in the form >> of seemingly random errors/crashes. Is that why? > Sorry for not having

Re: assert pg_class.relnatts is consistent

2020-02-13 Thread Amit Langote
On Thu, Feb 13, 2020 at 4:51 PM Amit Langote wrote: > On Thu, Feb 13, 2020 at 3:23 AM Justin Pryzby wrote: > > Forking this thread for two tangential patches which I think are more > > worthwhile than the original topic's patch. > >

Re: assert pg_class.relnatts is consistent

2020-02-13 Thread Justin Pryzby
On Thu, Feb 13, 2020 at 04:51:01PM +0900, Amit Langote wrote: > On Thu, Feb 13, 2020 at 3:23 AM Justin Pryzby wrote: > > Forking this thread for two tangential patches which I think are more > > worthwhile than the original topic's patch. > >

Re: assert pg_class.relnatts is consistent

2020-02-13 Thread Michael Paquier
On Thu, Feb 13, 2020 at 04:51:01PM +0900, Amit Langote wrote: > I would think the answer to that would be related to the answer of why > you think we need this assert in the first place? Taking this thread independently, and even after reading the thread mentioned upthread, I still don't quite

Re: assert pg_class.relnatts is consistent

2020-02-12 Thread Amit Langote
On Thu, Feb 13, 2020 at 3:23 AM Justin Pryzby wrote: > Forking this thread for two tangential patches which I think are more > worthwhile than the original topic's patch. > https://www.postgresql.org/message-id/20200207143935.GP403%40telsasoft.com > > Is there a better place to implement

assert pg_class.relnatts is consistent

2020-02-12 Thread Justin Pryzby
Forking this thread for two tangential patches which I think are more worthwhile than the original topic's patch. https://www.postgresql.org/message-id/20200207143935.GP403%40telsasoft.com Is there a better place to implement assertion from 0002 ? On Fri, Feb 07, 2020 at 08:39:35AM -0600, Justin