Mike,

If you defined your view as "select * from ..." then you will 
experience what you describe. And when you think about it, that 
definition literally asks for _all_  (*) columns.

Other than for quick and dirty situations (yes, I'm talking about 
code here <g>), I define views as:

Create view YourView (alias1,alias2,alias3,...) as +
 Select t1.Col1, t1.col2, t2.Col2 +
 from YourFirstTab as t1, YourSecTab as t2 +
 where ...

It's unambiguas and doesn't break when you change a view 
definition.

BenPetersen



On 15 Oct 2002, at 9:22, Ramsour Mike wrote:

> Good morning:
> 
> Quite by accident I discovered that I had a view that had been
> inadvertently defined with duplicate column names.  The data in the
> columns (both named GAUGE) was coming from two different tables.  This
> lead to some confusion when a user tried to query the view with
> criteria against the GAUGE column. Which GAUGE column was being
> referenced?  I assume R:Base probably uses the first GAUGE column it
> encounters.  At any rate, if I had done this once I knew there was a
> possibility that I had done it in other views.  In fact I discovered
> two other views with this situation.
> 
> To make a long story short, I created a quick and dirty command file
> that assembles a table with all view names and column names so that
> you can easily check to see if any views have duplicate column names. 
> Granted there MAY be a valid reason for having duplicate names but I
> can't think what it might be.  I hereby share my code in case anyone
> else wants to check their databases.  I make no guarantees or assume
> any liability for any damage that may occur as a result of using this
> code.  The code ran fine on my machine and it's been run through
> R:Code.  You will need to customize the command file to your 
> particular database name, etc.
> 
> As an aside, should R:Base allow such a thing to happen or should
> there be some kind of check for this?  Just curious.
> 
> Hope this helps someone.
> 
> Thanks
> Mike Ramsour
> Voice:  740-829-4340

================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

Reply via email to