Re: Is it possible to return custom type as proper ROW? - Mailing list pgsql-general

From Jeff Davis
Subject Re: Is it possible to return custom type as proper ROW?
Date
Msg-id 1160600528.31966.35.camel@dogma.v10.wvs
Whole thread Raw
In response to Re: Is it possible to return custom type as proper ROW?  ("Uwe C. Schroeder" <uwe@oss4u.com>)
List pgsql-general
On Wed, 2006-10-11 at 11:05 -0700, Uwe C. Schroeder wrote:
> On Wednesday 11 October 2006 10:42, A. Kretschmer wrote:
> > am  Wed, dem 11.10.2006, um 12:56:51 -0400 mailte Tom Lane folgendes:
> > > Andreas Kretschmer <akretschmer@spamfence.net> writes:
> > > > Joe Kramer <cckramer@gmail.com> schrieb:
> > > >> I want to get:
> > > >> item_id   |   last_update
> > > >> -------------------------------------
> > > >> 32         |  1234-12-12 12:12:12
> > > >
> > > > Untested:
> > > > SELECT item_id, last_update from public.new_item(3,2);
> > >
> > > Or just
> > >     SELECT * FROM public.new_item(3,2);
> >
> > Yes, but i have learned, that 'SELECT * ...' is evil...
>
> Well, "SELECT *" is only evil if your application relies on a specific column
> order to function. The moment you change the table layout and you're using
> "select *" your application will cease functioning.
> My app uses tons of select *, but then I wrote an object mapper that queries
> the information schema at startup - so it's aware of table changes and
> adjusts accordingly.
>

It's aware of the tables as they exist at startup. That may change
between when the mapper looks at the information schema and when it gets
the results of a query.

If you know what it's doing it's probably fine, but that doesn't seem
like a general solution.

Regards,
    Jeff Davis


pgsql-general by date:

Previous
From: Jonathan Vanasco
Date:
Subject: question on renaming a foreign key
Next
From: Vivek Khera
Date:
Subject: Re: [Slony1-general] Using slony with many schema's