pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #8684: Tables with custom range domain type cannot be analyzed
5+ messages / 3 participants
[nested] [flat]

* BUG #8684: Tables with custom range domain type cannot be analyzed
@ 2013-12-17 17:10 bneumeier@gmail.com
  2013-12-18 16:56 ` Re: BUG #8684: Tables with custom range domain type cannot be analyzed Brett Neumeier <bneumeier@gmail.com>
  2013-12-23 17:45 ` Re: BUG #8684: Tables with custom range domain type cannot be analyzed Brett Neumeier <bneumeier@gmail.com>
  2013-12-24 03:20 ` Re: BUG #8684: Tables with custom range domain type cannot be analyzed Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 3 replies; 5+ messages in thread

From: bneumeier@gmail.com @ 2013-12-17 17:10 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      8684
Logged by:          Brett Neumeier
Email address:      bneumeier@gmail.com
PostgreSQL version: 9.3.2
Operating system:   Ubuntu Linux 13.04 64-bit
Description:        

In 9.3.2 and master HEAD (3b97e6823b), in a freshly-created postgresql
database (with all tests passing from "make check-world"), this sequence:


-----cut here-----
CREATE DOMAIN range_domain AS tstzrange
	CONSTRAINT exclusive_upper CHECK ((NOT upper_inc(VALUE)))
	CONSTRAINT inclusive_lower CHECK (lower_inc(VALUE));


CREATE TABLE cannot_analyze (
    rng range_domain NOT NULL
);


VACUUM ANALYZE;
-----cut here-----


results in the analyze failing with "ERROR:  type 16385 is not a range type"
rather than succeeding.


(This error is being emitted from range_get_typcache because the result of
lookup_type_cache(rngtypid, TYPECACHE_RANGE_INFO) has a rngelemtype of NULL,
but I haven't tried to figure out why that is or what it should be instead.)



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #8684: Tables with custom range domain type cannot be analyzed
  2013-12-17 17:10 BUG #8684: Tables with custom range domain type cannot be analyzed bneumeier@gmail.com
@ 2013-12-18 16:56 ` Brett Neumeier <bneumeier@gmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Brett Neumeier @ 2013-12-18 16:56 UTC (permalink / raw)
  To: pgsql-bugs

On Tue, Dec 17, 2013 at 11:10 AM, <bneumeier@gmail.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      8684
> Logged by:          Brett Neumeier
> Email address:      bneumeier@gmail.com
> PostgreSQL version: 9.3.2
> Operating system:   Ubuntu Linux 13.04 64-bit
> Description:
>
> In 9.3.2 and master HEAD (3b97e6823b), in a freshly-created postgresql
> database (with all tests passing from "make check-world"), this sequence:
>

Also, in case it helps, I've localized this issue to commit 918eee0c
"Collect and use histograms of lower and upper bounds for range types."

-- 
Brett Neumeier (bneumeier@gmail.com)

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #8684: Tables with custom range domain type cannot be analyzed
  2013-12-17 17:10 BUG #8684: Tables with custom range domain type cannot be analyzed bneumeier@gmail.com
@ 2013-12-23 17:45 ` Brett Neumeier <bneumeier@gmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Brett Neumeier @ 2013-12-23 17:45 UTC (permalink / raw)
  To: pgsql-bugs

On Tue, Dec 17, 2013 at 11:10 AM, <bneumeier@gmail.com> wrote:

> Bug reference:      8684
>
> (This error is being emitted from range_get_typcache because the result of
> lookup_type_cache(rngtypid, TYPECACHE_RANGE_INFO) has a rngelemtype of
> NULL,
> but I haven't tried to figure out why that is or what it should be
> instead.)
>

The problem appears to be that domains based on a range type are found by
the histogram-construction code, but have no range type information within
them; the range info is in the base type for the domain instead.

Perhaps this function should detect domain types and iteratively climb up
the base-type hierarchy until it finds the actual range type?

I would be happy to attempt such a thing and see if it helps, but have very
little familiarity with the postgresql codebase. Is there a document
somewhere that describes type lookup functions?

-- 
Brett Neumeier (bneumeier@gmail.com)

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #8684: Tables with custom range domain type cannot be analyzed
  2013-12-17 17:10 BUG #8684: Tables with custom range domain type cannot be analyzed bneumeier@gmail.com
@ 2013-12-24 03:20 ` Tom Lane <tgl@sss.pgh.pa.us>
  2013-12-24 22:42   ` Re: BUG #8684: Tables with custom range domain type cannot be analyzed Brett Neumeier <bneumeier@gmail.com>
  2 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2013-12-24 03:20 UTC (permalink / raw)
  To: bneumeier@gmail.com; +Cc: pgsql-bugs

bneumeier@gmail.com writes:
> [ ANALYZE doesn't work on a domain over a range type ]

Fixed, thanks for the report!  Patch against 9.3 is here:
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=663f8419b6e75b6ebc4c22d10fbe55f133...

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #8684: Tables with custom range domain type cannot be analyzed
  2013-12-17 17:10 BUG #8684: Tables with custom range domain type cannot be analyzed bneumeier@gmail.com
  2013-12-24 03:20 ` Re: BUG #8684: Tables with custom range domain type cannot be analyzed Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-12-24 22:42   ` Brett Neumeier <bneumeier@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Brett Neumeier @ 2013-12-24 22:42 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs

On Mon, Dec 23, 2013 at 9:20 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> bneumeier@gmail.com writes:
> > [ ANALYZE doesn't work on a domain over a range type ]
>
> Fixed, thanks for the report!  Patch against 9.3 is here:
>
> http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=663f8419b6e75b6ebc4c22d10fbe55f133...
>

Thank you Mr Lane! Your help is very much appreciated. I've confirmed that
this fixes the issue we were having.

-- 
Brett Neumeier (bneumeier@gmail.com)

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2013-12-24 22:42 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-12-17 17:10 BUG #8684: Tables with custom range domain type cannot be analyzed bneumeier@gmail.com
2013-12-18 16:56 ` Brett Neumeier <bneumeier@gmail.com>
2013-12-23 17:45 ` Brett Neumeier <bneumeier@gmail.com>
2013-12-24 03:20 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-12-24 22:42   ` Brett Neumeier <bneumeier@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox