<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Barend Köbben wrote:
<blockquote cite="midC373B412.952B%25kobben@itc.nl" type="cite">
  <pre wrap="">Auw!

That's what a all a nasty hack...
What's wrong with just doing a
SELECT thing _want_want1,..., thing _want_n
And not include the thing_you_dont_want in the list...?
  </pre>
</blockquote>
I'm just answering the question that was asked :-) .  The other way to
do it would be to something like<br>
<br>
create table t2 as select * from t1 where 1 <> 1;<br>
alter table t2 drop column no_view_col;<br>
alter table t1 inherits t2;<br>
select * from t2;<br>
<br>
Arguably, both this and my previous solution have the same issues...but
should work about the same way.<br>
<br>
As a side note, I'm not saying I do (or don't) advocate either
method..I'm just proposing a solution to the problem presented.  I'm
not sure that there is a better one (aside from writing the query that
you need and using it).  The advantage here is that both solutions I've
mentioned meet the outlined constraints - we only know the column to be
omitted, not the other columns...<br>
<br>
I'd have to dig deeper, but there also might be a way to designate that
column a system column (which would make it invisible perhaps) much
like the ctid column...  Of course, this could be just as bad as the
other solutions proposed...if not worse.<br>
<br>
Chander<br>
<blockquote cite="midC373B412.952B%25kobben@itc.nl" type="cite">
  <pre wrap="">
__ 
Barend Köbben
International Institute for Geo-information
Sciences and Earth Observation (ITC)
PO Box 6, 7500AA Enschede (The Netherlands)
ph: +31 (0)53 4874253; fax: +31 (0)53 4874335



On 28-11-2007 23:07, "Chander Ganesan" <a class="moz-txt-link-rfc2396E" href="mailto:chander@otg-nc.com"><chander@otg-nc.com></a> wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">Matt Doughty wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">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.

      </pre>
    </blockquote>
    <pre wrap="">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
    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Chander Ganesan
The Open Technology Group
One Copley Parkway, Suite 210
Morrisville, NC  27560
Phone: 877-258-8987/919-463-0999
<a class="moz-txt-link-freetext" href="http://www.otg-nc.com">http://www.otg-nc.com</a>
Expert PostgreSQL Training
</pre>
</body>
</html>