Re: Getting NOT NULL constraint from pg_attribute

2018-08-23 Thread Tom Lane
Andres Freund writes: > And arguably there's a fair bit of redundancy in pg_attribute, just > because it's convenient for tupledescs. Given that pg_attribute very > commonly is the largest catalog table by far, that very well could use > some attention. Without tupdescs in mind, there's really

Re: Getting NOT NULL constraint from pg_attribute

2018-08-23 Thread Andres Freund
On 2018-08-23 11:04:30 -0400, Tom Lane wrote: > "David G. Johnston" writes: > > On Monday, August 20, 2018, Wu Ivy wrote: > >> Why are SELECT query never marked nullable? > > > Basically the nullability property is used by the planner for optimization > > during the joining of physical tables.

Re: Getting NOT NULL constraint from pg_attribute

2018-08-23 Thread Tom Lane
"David G. Johnston" writes: > On Monday, August 20, 2018, Wu Ivy wrote: >> Why are SELECT query never marked nullable? > Basically the nullability property is used by the planner for optimization > during the joining of physical tables. As soon as you try outputting > columns the ability to

Re: Getting NOT NULL constraint from pg_attribute

2018-08-21 Thread Wu Ivy
Thanks for the response. Really appreciate it! Regards, Ivy 2018-08-20 10:40 GMT-07:00 David G. Johnston : > On Monday, August 20, 2018, Wu Ivy wrote: >> >> Thanks for the quick respond. >> Why are SELECT query never marked nullable? For nullable columns, when I >> call SPI_getvalue(), the

Re: Getting NOT NULL constraint from pg_attribute

2018-08-20 Thread David G. Johnston
On Monday, August 20, 2018, Wu Ivy wrote: > > Thanks for the quick respond. > Why are SELECT query never marked nullable? For nullable columns, when I > call SPI_getvalue(), the result (in char*) is NULL. I don’t think I’m too > clear on the definition of *attnotnull*. Can you give me a example

Re: Getting NOT NULL constraint from pg_attribute

2018-08-20 Thread Wu Ivy
Hi tom, Thanks for the quick respond. Why are SELECT query never marked nullable? For nullable columns, when I call SPI_getvalue(), the result (in char*) is NULL. I don’t think I’m too clear on the definition of attnotnull. Can you give me a example in which the tupleTable is can be marked

Re: Getting NOT NULL constraint from pg_attribute

2018-08-17 Thread Tom Lane
Wu Ivy writes: > I’m currently building a Postgres C extension that fetch data from a Postgres > table. > Since the table can be large, in order to prevent memory overrun, I use > SPI_cursor_fetch to fetch chunks of data. The result rows are saved in > SPITupleTable* SPI_tuptable and

Getting NOT NULL constraint from pg_attribute

2018-08-17 Thread Wu Ivy
Hi developers, I’m currently building a Postgres C extension that fetch data from a Postgres table. Since the table can be large, in order to prevent memory overrun, I use SPI_cursor_fetch to fetch chunks of data. The result rows are saved in SPITupleTable* SPI_tuptable and attributes are