Re: when does CREATE VIEW not create a view? - Mailing list pgsql-hackers

From Ross J. Reedstrom
Subject Re: when does CREATE VIEW not create a view?
Date
Msg-id 20000828102116.B1457@rice.edu
Whole thread Raw
In response to Re: when does CREATE VIEW not create a view?  (Malcontent <malcontent@msgto.com>)
List pgsql-hackers
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
problem. 

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
-- 
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005


pgsql-hackers by date:

Previous
From: Patrick Welche
Date:
Subject: Re: How Do You Pronounce "PostgreSQL"?
Next
From: Brook Milligan
Date:
Subject: Re: when does CREATE VIEW not create a view?