dbTalk Databases Forums  

Create VIEW readability

comp.databases.postgresql comp.databases.postgresql


Discuss Create VIEW readability in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Johannes Bauer
 
Posts: n/a

Default Re: Create VIEW readability - 08-25-2008 , 09:36 AM






Laurenz Albe schrieb:

Quote:
I don't think that i possible, and you'd have to stick with one of your
two solutions.
OK.

Quote:
What is so unreadable about

SELECT h1.ip AS clientip,
dhcp.filename AS pxefilename, dhcp.nextserverhostid,
h2.ip AS serverip,
dns1.hostname AS clienthostname,
dns2.hostname AS clienthostname,
FROM hosts h1
JOIN dhcppxe dhcp ON h1.hostid = dhcp.hostid
JOIN hosts h2 ON dhcp.nextserverhostid = h2.hostid
LEFT OUTER JOIN dns dns1 ON h1.ip = dns1.ip
LEFT OUTER JOIN dns dns2 ON h2.ip = dns2.ip;

Of course it is a matter of taste, but I think it is easier to understand
than your stack of view definitions.
Yes, indeed it is much more readable than the subqueries, which I used
initially because I found them more readable than the JOINs. But you are
right, I think I'll stick with your solution.

Thanks,
Johannes


Reply With Quote
  #12  
Old   
Johannes Bauer
 
Posts: n/a

Default Re: Create VIEW readability - 08-25-2008 , 09:36 AM






Laurenz Albe schrieb:

Quote:
I don't think that i possible, and you'd have to stick with one of your
two solutions.
OK.

Quote:
What is so unreadable about

SELECT h1.ip AS clientip,
dhcp.filename AS pxefilename, dhcp.nextserverhostid,
h2.ip AS serverip,
dns1.hostname AS clienthostname,
dns2.hostname AS clienthostname,
FROM hosts h1
JOIN dhcppxe dhcp ON h1.hostid = dhcp.hostid
JOIN hosts h2 ON dhcp.nextserverhostid = h2.hostid
LEFT OUTER JOIN dns dns1 ON h1.ip = dns1.ip
LEFT OUTER JOIN dns dns2 ON h2.ip = dns2.ip;

Of course it is a matter of taste, but I think it is easier to understand
than your stack of view definitions.
Yes, indeed it is much more readable than the subqueries, which I used
initially because I found them more readable than the JOINs. But you are
right, I think I'll stick with your solution.

Thanks,
Johannes


Reply With Quote
  #13  
Old   
Johannes Bauer
 
Posts: n/a

Default Re: Create VIEW readability - 08-25-2008 , 09:36 AM



Laurenz Albe schrieb:

Quote:
I don't think that i possible, and you'd have to stick with one of your
two solutions.
OK.

Quote:
What is so unreadable about

SELECT h1.ip AS clientip,
dhcp.filename AS pxefilename, dhcp.nextserverhostid,
h2.ip AS serverip,
dns1.hostname AS clienthostname,
dns2.hostname AS clienthostname,
FROM hosts h1
JOIN dhcppxe dhcp ON h1.hostid = dhcp.hostid
JOIN hosts h2 ON dhcp.nextserverhostid = h2.hostid
LEFT OUTER JOIN dns dns1 ON h1.ip = dns1.ip
LEFT OUTER JOIN dns dns2 ON h2.ip = dns2.ip;

Of course it is a matter of taste, but I think it is easier to understand
than your stack of view definitions.
Yes, indeed it is much more readable than the subqueries, which I used
initially because I found them more readable than the JOINs. But you are
right, I think I'll stick with your solution.

Thanks,
Johannes


Reply With Quote
  #14  
Old   
Johannes Bauer
 
Posts: n/a

Default Re: Create VIEW readability - 08-25-2008 , 09:36 AM



Laurenz Albe schrieb:

Quote:
I don't think that i possible, and you'd have to stick with one of your
two solutions.
OK.

Quote:
What is so unreadable about

SELECT h1.ip AS clientip,
dhcp.filename AS pxefilename, dhcp.nextserverhostid,
h2.ip AS serverip,
dns1.hostname AS clienthostname,
dns2.hostname AS clienthostname,
FROM hosts h1
JOIN dhcppxe dhcp ON h1.hostid = dhcp.hostid
JOIN hosts h2 ON dhcp.nextserverhostid = h2.hostid
LEFT OUTER JOIN dns dns1 ON h1.ip = dns1.ip
LEFT OUTER JOIN dns dns2 ON h2.ip = dns2.ip;

Of course it is a matter of taste, but I think it is easier to understand
than your stack of view definitions.
Yes, indeed it is much more readable than the subqueries, which I used
initially because I found them more readable than the JOINs. But you are
right, I think I'll stick with your solution.

Thanks,
Johannes


Reply With Quote
  #15  
Old   
Johannes Bauer
 
Posts: n/a

Default Re: Create VIEW readability - 08-25-2008 , 09:36 AM



Laurenz Albe schrieb:

Quote:
I don't think that i possible, and you'd have to stick with one of your
two solutions.
OK.

Quote:
What is so unreadable about

SELECT h1.ip AS clientip,
dhcp.filename AS pxefilename, dhcp.nextserverhostid,
h2.ip AS serverip,
dns1.hostname AS clienthostname,
dns2.hostname AS clienthostname,
FROM hosts h1
JOIN dhcppxe dhcp ON h1.hostid = dhcp.hostid
JOIN hosts h2 ON dhcp.nextserverhostid = h2.hostid
LEFT OUTER JOIN dns dns1 ON h1.ip = dns1.ip
LEFT OUTER JOIN dns dns2 ON h2.ip = dns2.ip;

Of course it is a matter of taste, but I think it is easier to understand
than your stack of view definitions.
Yes, indeed it is much more readable than the subqueries, which I used
initially because I found them more readable than the JOINs. But you are
right, I think I'll stick with your solution.

Thanks,
Johannes


Reply With Quote
  #16  
Old   
Johannes Bauer
 
Posts: n/a

Default Re: Create VIEW readability - 08-25-2008 , 09:36 AM



Laurenz Albe schrieb:

Quote:
I don't think that i possible, and you'd have to stick with one of your
two solutions.
OK.

Quote:
What is so unreadable about

SELECT h1.ip AS clientip,
dhcp.filename AS pxefilename, dhcp.nextserverhostid,
h2.ip AS serverip,
dns1.hostname AS clienthostname,
dns2.hostname AS clienthostname,
FROM hosts h1
JOIN dhcppxe dhcp ON h1.hostid = dhcp.hostid
JOIN hosts h2 ON dhcp.nextserverhostid = h2.hostid
LEFT OUTER JOIN dns dns1 ON h1.ip = dns1.ip
LEFT OUTER JOIN dns dns2 ON h2.ip = dns2.ip;

Of course it is a matter of taste, but I think it is easier to understand
than your stack of view definitions.
Yes, indeed it is much more readable than the subqueries, which I used
initially because I found them more readable than the JOINs. But you are
right, I think I'll stick with your solution.

Thanks,
Johannes


Reply With Quote
  #17  
Old   
Johannes Bauer
 
Posts: n/a

Default Re: Create VIEW readability - 08-25-2008 , 09:36 AM



Laurenz Albe schrieb:

Quote:
I don't think that i possible, and you'd have to stick with one of your
two solutions.
OK.

Quote:
What is so unreadable about

SELECT h1.ip AS clientip,
dhcp.filename AS pxefilename, dhcp.nextserverhostid,
h2.ip AS serverip,
dns1.hostname AS clienthostname,
dns2.hostname AS clienthostname,
FROM hosts h1
JOIN dhcppxe dhcp ON h1.hostid = dhcp.hostid
JOIN hosts h2 ON dhcp.nextserverhostid = h2.hostid
LEFT OUTER JOIN dns dns1 ON h1.ip = dns1.ip
LEFT OUTER JOIN dns dns2 ON h2.ip = dns2.ip;

Of course it is a matter of taste, but I think it is easier to understand
than your stack of view definitions.
Yes, indeed it is much more readable than the subqueries, which I used
initially because I found them more readable than the JOINs. But you are
right, I think I'll stick with your solution.

Thanks,
Johannes


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.