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 20000829124646.C10972@rice.edu
Whole thread Raw
In response to Re: when does CREATE VIEW not create a view?  (t-ishii@sra.co.jp)
Responses Re: when does CREATE VIEW not create a view?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, Aug 29, 2000 at 10:12:38AM +0900, t-ishii@sra.co.jp wrote:
> 
> No problem for repatching I think, since we are in the development
> cycle anyway.

Oh well.

> 
> > The problem is that I just chop it off at NAMEDATALEN, which might be
> > in the middle of a multibyte character, correct?
> 
> Exactly.

Good. Understanding the problem is critical to fixing it. ;-)

> 
> > Ah, I see code in parser/scan.l that does the multibyte aware version
> > of the chop. Should I just rewrite my patch with that code as a model?
> 
> Please do so. If you need any help, please let me know.

O.K.

I'm just about done with it.  Since there are three places in the code that
seem to know about how to make a rulename from a viewname, and one of them
is a function named MakeRetrieveViewRuleName(), I've put the #ifdef MULTIBYTE
in there, and called this function from the other places that need it.

Only problem is in utils/adt/ruleutils.c

There's code in there that constructs potential rule names that start with
'_ret' as well as '_RET', in order to use an SPI query to find the rule
associated with a view. This is the only occurance of the string '"_ret'
in the codebase, and I can't find a way a rule might get that name, nor an
example in either the 6.5.0 and 7.0.2 databases I've got here.  

Someone when to the trouble of writing the query that way, but I'm not
convinced it's needed anymore. I'm guessing there was an extra tolower
somewhere that doesn't happen anymore (Tom Lane tracked down a bunch
of these when I whined about MultiCase tablenames breaking, nigh on a
year ago)

Should I trash it? Anyone have anything returned from

SELECT rulename from pg_rewrite where rulename ~ '^_ret';

on any database with view defined?

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: Tom Lane
Date:
Subject: Re: Backend-internal SPI operations
Next
From: Mark Hollomon
Date:
Subject: disallow LOCK on a view - the Tom Lane remix