Re: [SQL] Inherits is not encouraged?

2009-03-10 Thread Karsten Hilbert
On Mon, Mar 09, 2009 at 07:55:35PM -0400, Tom Lane wrote:

> Emi Lu  writes:
> > (1) Is possible that I could change the column of a table that is 
> > defined by Inherits?
> 
> > e.g., t1(col1, col2, col3); create table tx(colx) Inherits (t1)
> > I'd like to get tx shown as (col1, colx, col2, col3).
> 
> No, you don't really have a lot of control over that.

"Explicit select list" would be one way (and the one that's
encouraged as good practice):

select col1, colx, col2, col3 from tx;

If that doesn't cut it (say, generic viewer which doesn't
know what is going to be viewed) - use a view over tx. Maybe
even "hide" the table tx as "table_tx" and name the view
itself "tx". Care needs to be taken then to either setup
appropriate rules or to make insert/update/delete go to
"table_tx".

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


[SQL] Problem with an Empty Column

2009-03-10 Thread hidura
Good Morning list, I am new in the PostgreSQL list, and i have a problem  
with a query because i have an empty column in a empty table and i compare  
this empty column with a column what have values in other table i use an  
LEFT OUTER JOIN and works well, but when i filled the empty table with data  
and compare again the query give me the same result than if the table was  
empty, here is the code of my query:

SELECT supplierbill_tbl.id
FROM supplierbill_tbl
LEFT OUTER JOIN agrouptransacc_tbl
ON supplierbill_tbl.id > agrouptransacc_tbl.splbillid

--
Diego I. Hidalgo D.


Re: [SQL] Problem with an Empty Column

2009-03-10 Thread Scott Marlowe
On Tue, Mar 10, 2009 at 11:41 PM,   wrote:
> Good Morning list, I am new in the PostgreSQL list, and i have a problem
> with a query because i have an empty column in a empty table and i compare
> this empty column with a column what have values in other table i use an
> LEFT OUTER JOIN and works well, but when i filled the empty table with data
> and compare again the query give me the same result than if the table was
> empty, here is the code of my query:
> SELECT supplierbill_tbl.id
> FROM supplierbill_tbl
> LEFT OUTER JOIN agrouptransacc_tbl
> ON supplierbill_tbl.id > agrouptransacc_tbl.splbillid

I think we need a more complete example.  Note you can generate rows
in a table with generate_series() pretty easily for testing.

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql