[postgis-users] Except

Chander Ganesan chander at otg-nc.com
Wed Nov 28 14:07:44 PST 2007


Matt Doughty wrote:
>
> Hi,
>
>  
>
> Is there a way of selecting all fields except one in particular? I'd 
> like to create a query that says something like: select * except 
> field01.  The thing is the query needs to be valid for a number of 
> different tables, each with a different set of fields apart from one 
> (gid), which I don't want to select.
>
Well, you could do the following:

begin transaction;
alter table table_name drop column field01;
select * from table_name;
rollback;

I think that should work.  Keep in mind that you wouldn't want to commit 
the transaction, or you would lose the column data.

Don't try this in other databases, PostgreSQL's DDL is transaction 
safe...so you can do such things.

Hope that helps

-- 
Chander Ganesan
The Open Technology Group
One Copley Parkway, Suite 210
Morrisville, NC  27560
Phone: 877-258-8987/919-463-0999
http://www.otg-nc.com
Export PostgreSQL Training


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20071128/fce0b1c7/attachment.html>


More information about the postgis-users mailing list