Re: [HACKERS] Beta for 4:30AST ... ?

From: Don Baccus <dhogaza(at)pacifier(dot)com>
To: Ed Loehr <eloehr(at)austin(dot)rr(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, The Hermit Hacker <scrappy(at)hub(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Beta for 4:30AST ... ?
Date: 2000-02-21 18:27:15
Message-ID: 3.0.1.32.20000221102715.010ada40@mail.pacifier.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 12:11 PM 2/21/00 -0600, Ed Loehr wrote:
>Don Baccus wrote:
>>
>> Even pg_dump works, though I had to modify a couple of views in order
>> to get them reload correctly.
>
>Don, could you elaborate on what you had to do to make your views
>reload correctly?

Good timing - I was about to post on this subject anyway.

I was able to fix my views by changing:

create view foo as select * from bar;

to:

...select * from bar bar;

In other words, an explicit declaration of the range table name (is
that the right term?P my mind's numb from porting queries all weekend)
leads to a rule that will reload.

I figured this out because there are some fairly complex views in
this datamodel, which use explicit names to avoid ambiguous column
references.

The standard actually says that a from clause like "from bar"
implicitly declares "bar" for you, i.e. is exactly equivalent
to "from bar bar". If Postgres name scoping - which I know is
not standard-compliant in the JOIN syntax case - is close enough
so that a transformation of "from bar" to "from bar bar" could
be done in the parser without breaking existing code, then a
lot more views could be successfully be dumped and reloaded.

Would all views dump/reload, or are there other problems I don't know
about? I'm not in a position to judge, I've been too deeply embedded
in getting this toolkit ready for release (our first will be Wednesday)
to worry about the general case. However, I do know that doing the
transformation by hand in the datamodel source has fixed the problem
for me.

Does anyone know if there are other problems?

Even if there are, a simple transformation such as I describe would
help - IF it didn't break existing code. If it would break existing
code, then it is due to non-compliance with the standard so perhaps
wouldn't be such a terrible thing, either. I'm not really in a
position to judge.

What do folks think?

- Don Baccus, Portland OR <dhogaza(at)pacifier(dot)com>
Nature photos, on-line guides, Pacific Northwest
Rare Bird Alert Service and other goodies at
http://donb.photo.net.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-02-21 18:59:07 Re: [HACKERS] Beta for 4:30AST ... ?
Previous Message rob.c 2000-02-21 18:17:46 subscribe