Skip site navigation (1) Skip section navigation (2)

Re: when does CREATE VIEW not create a view?

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: when does CREATE VIEW not create a view?
Date: 2000-08-28 15:21:16
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
On Thu, Aug 24, 2000 at 12:30:00AM -0600, Malcontent wrote:
> Brook Milligan wrote:
> > 
> >    See my other reply about what gets added: the problem is the rewrite
> >    rule name, as you guessed.
> > 
> >    Here's a patch that silently truncates the generated rule name.
> > 
> What are the consequences of changing the NAMEDATALEN and recompiling?
> Doesn't that seem like a better solution then to truncate the view name? 

Increasing NAMEDATALEN is a relatively common customization, but
it does cost you efficency of storage in the system tables: all the
identifiers take fixed NAMEDATALEN char fields, for speed of access. In
this particular case, the view name is not getting truncated (that will
already happen, if you try to create a view or table with a name longer
than NAMEDATALEN).  The problem is that creation of a view involves
the backend creating a table with the supplied name, building an ON
SELECT INSTEAD rule, whose (unique) name is created by prepending _RET
to the supplied view name. Since this goes into a NAMEDATALEN field in a
system table, it needs to be truncated. Current code fails by not creating
the rule if the supplied name is within 4 characters of NAMEDATALEN,
but leaving the underlying table around. Since end user code _never_
needs to manipulate the rule directly, truncating the name is not a

The patch I proposed has not been put in CVS, because I need to add
multibyte support. Hmm, anyone got any spare round tuits? (I've got
plenty of square ones...)

Ross J. Reedstrom, Ph.D., <reedstrm(at)rice(dot)edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005

In response to

pgsql-hackers by date

Next:From: Brook MilliganDate: 2000-08-28 15:24:00
Subject: Re: Re: Too many open files (was Re: spinlock problems reported earlier)
Previous:From: Patrick WelcheDate: 2000-08-28 15:09:34
Subject: Re: How Do You Pronounce "PostgreSQL"?

pgsql-patches by date

Next:From: Brook MilliganDate: 2000-08-28 15:26:13
Subject: Re: when does CREATE VIEW not create a view?
Previous:From: Tom LaneDate: 2000-08-28 14:20:59
Subject: Re: Bug in regression tests

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group