Re: Two questions about "pg_constraint"

2022-08-27 Thread Bryn Llewellyn
That's the answer I was seeking. So it's case closed for both of my « Two questions about "pg_constraint" ». Thanks, Tom. And thanks to the others who've contributed to this thread. t...@sss.pgh.pa.us wrote: > b...@yugabyte.com writes: > > My other question w

Re: Two questions about "pg_constraint"

2022-08-26 Thread Tom Lane
Bryn Llewellyn writes: > My other question was about the "connamespace" column. It seemed to me, > both at first and still now, that this is a clear instance of a > transitive dependency. I think a more productive way to think about it is that it's denormalization for efficiency; specifically to

Re: Two questions about "pg_constraint"

2022-08-26 Thread Christophe Pettus
> On Aug 26, 2022, at 18:47, Bryn Llewellyn wrote: > No, I’m not proposing any code change. Thanks for clarifying.

Re: Two questions about "pg_constraint"

2022-08-26 Thread Bryn Llewellyn
> x...@thebuild.com wrote: > >> b...@yugabyte.com wrote: >> [...] > > I'm still not clear on what you are proposing. Are you proposing a change to > PostgreSQL to remove the "connamespace" column from the "pg_constraint" > table, since it can be derived from other tables? No, I’m not proposing

Re: Two questions about "pg_constraint"

2022-08-26 Thread Christophe Pettus
> On Aug 26, 2022, at 15:33, Bryn Llewellyn wrote: > [...] I'm still not clear on what you are proposing. Are you proposing a change to PostgreSQL to remove the "connamespace" column from the "pg_constraint" table, since it can be derived from other tables?

Re: Two questions about "pg_constraint"

2022-08-26 Thread Bryn Llewellyn
> x...@thebuild.com wrote: > >> b...@yugabyte.com wrote: >> [...] > > I've read this a few times, and I am having trouble understanding what > behavior you were expecting out of PostgreSQL, and what behavior you received > that you didn't think was correct. If it is "pg_constraint has a column

Re: Two questions about "pg_constraint"

2022-08-25 Thread Christophe Pettus
> On Aug 25, 2022, at 21:43, Bryn Llewellyn wrote: > [...] I've read this a few times, and I am having trouble understanding what behavior you were expecting out of PostgreSQL, and what behavior you received that you didn't think was correct. If it is "pg_constraint has a column connamespac

Re: Two questions about "pg_constraint"

2022-08-25 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > >> bryn@yugabyte.comwrote: >> >> Question 1: why does "pg_constraint" have a "connamespace" column? > > create table c1 (id integer, constraint pk1 primary key(id)); > > create table c2 (id integer, constraint pk1 primary key(id)); > ERROR: relation "pk1" a

Re: Two questions about "pg_constraint"

2022-08-24 Thread Bryn Llewellyn
> t...@sss.pgh.pa.us wrote: > >> b...@yugabyte.com writes: >> >> Question 1: why does "pg_constraint" have a "connamespace" column? > > You appear to be assuming that every pg_constraint entry is tied to a table. > This isn't so. I see how this might have appeared to be the case. But I did, ve

Greg Sabino Mullane ? Re: Two questions about "pg_constraint"

2022-08-24 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > >> b...@yugabyte.com wrote: >> >> Thanks, Adrian. I should have tried Google for "remove pg_constraint >> consrc". This finds the quote as the top hit. > > To see all release notes together go here: > > https://bucardo.org/postgres_all_versions > > Then yo

Re: Two questions about "pg_constraint"

2022-08-24 Thread Adrian Klaver
On 8/24/22 13:43, Bryn Llewellyn wrote: /adrian.kla...@aklaver.com wrote:/ Thanks, Adrian. I should have tried Google for "remove pg_constraint consrc". This finds the quote as the top hit. To see all release notes together go here: https://bucardo.org/

Re: Two questions about "pg_constraint"

2022-08-24 Thread Tom Lane
Bryn Llewellyn writes: > *Question 1: why does "pg_constraint" have a "connamespace" column?* You appear to be assuming that every pg_constraint entry is tied to a table. This isn't so. (1) That catalog also carries check constraints for domains, which are tied to types instead. Yeah, you coul

Re: Two questions about "pg_constraint"

2022-08-24 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > >> b...@yugabyte.com wrote: >> >> Question 2: what happened to the column "consrc"? > > It was in 11 but not later, so let's look at release notes... HERE: https://www.postgresql.org/docs/12/release-12.html > « > Remove obsolete pg_constraint.consrc column

Re: Two questions about "pg_constraint"

2022-08-24 Thread Adrian Klaver
On 8/24/22 13:11, Bryn Llewellyn wrote: *Question 1: why does "pg_constraint" have a "connamespace" column?* I created this temporary view (using PG 14.4): *create temporary view all_constraints(t_owner, t_schema, t_name, c_name, same) as select   r.rolname,   s.nspname,   c.relname,   x.

Re: Two questions about "pg_constraint"

2022-08-24 Thread Adrian Klaver
On 8/24/22 13:17, Adrian Klaver wrote: On 8/24/22 13:11, Bryn Llewellyn wrote: Ad hoc queries in my PG 11.9 env show results like « (v = lower(v)) » in this column for my tables. This is useful information. But the PG 14 version of "pg_constraint" has no such column (and nor does the doc men

Re: Two questions about "pg_constraint"

2022-08-24 Thread Adrian Klaver
On 8/24/22 13:11, Bryn Llewellyn wrote: *Question 1: why does "pg_constraint" have a "connamespace" column?* What do you think? *Question 2: what happened to the column "consrc"?* The PG 11 account of "pg_constraint" https://www.postgresql.org/docs/11/catalog-pg-constraint.html

Two questions about "pg_constraint"

2022-08-24 Thread Bryn Llewellyn
*Question 1: why does "pg_constraint" have a "connamespace" column?* I created this temporary view (using PG 14.4): create temporary view all_constraints(t_owner, t_schema, t_name, c_name, same) as select r.rolname, s.nspname, c.relname, x.conname, (x.connamespace = c.relnamespace) fro