From: | Dave Cramer <Dave(at)micro-automation(dot)net> |
---|---|
To: | Ray Madigan <ray(at)madigans(dot)org> |
Cc: | PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: getTableName |
Date: | 2003-01-26 20:32:25 |
Message-ID: | 1043613144.21634.151.camel@inspiron.cramers |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Ray,
At the moment the server doesn't tell us which table a column belongs
to. So the short answer is no.
The longer answer is that we need support from the backend to do this.
For instance the following select.
select a as b, c as d, e as f from foo as c1.
The backend is the only one that knows which table which came from.
Dave
On Sun, 2003-01-26 at 14:21, Ray Madigan wrote:
> I am a tool writer and need to figure out how to get the name
> of the table the resultset is for. I have written a set of
> tools that eventually pass a class the resultset for processing,
> and have absolutely no idea what the table name for each of the
> rows are in the resultset.
>
> Suppose i execute a query that has several tables named in the
> FROM clause, when i get the result back i have no idea what
> column comes from which row. Is there a way to figure this out?
>
> Thanks
> Ray
>
> -----Original Message-----
> From: pgsql-jdbc-owner(at)postgresql(dot)org
> [mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of Dror Matalon
> Sent: Monday, December 16, 2002 11:57 AM
> To: PostgreSQL JDBC
> Subject: Re: [JDBC] getTableName
>
>
> On Mon, Dec 16, 2002 at 02:39:47PM -0500, Dave Cramer wrote:
> > Unfortunately we have no idea which table belongs with which column.
> >
> > We would need the server to return fully qualified names such as
> > table.col
>
> Any idea how hard would it be to get the server to provide this
> functionality?
>
> By the way, mysql has had this functionality for at least a couple of
> years.
>
> Dror
>
> >
> > Dave
> > On Mon, 2002-12-16 at 14:18, Dror Matalon wrote:
> > > On Mon, Dec 16, 2002 at 11:00:24AM -0800, Barry Lind wrote:
> > > > You can also have lots of fun with getTableName() as well when the
> > > > 'table' may be a subquery in the from clause. It isn't clear what
> > > > should be returned in many cases even if the server did support more.
> > >
> > >
> > > But at this point the driver doesn't return the table name even in cases
> > > where it's clear what the tablename should be.
> > >
> > >
> > > For instance if you do
> > >
> > > select a from foo;
> > >
> > > you get an empty string instead of "foo" as the table name. How hard
> > > would it be to implement this in the driver? Is this something that the
> > > server has available that the driver could grab?
> > >
> > > This is an important feature for tool writers. For instance, I want to
> > > display a URL field as a <href> in a report. I keep meta information
> > > about this field, but I can't use it since I don't know which field it
> > > is when the user creates a SQL report because I don't know which table
> > > it belongs to.
> > >
> > > Getting getTableName() to work would solve this problem.
> > >
> > > Regards,
> > >
> > > Dror
> > >
> > >
> > > >
> > > > thanks,
> > > > --Barry
> > > >
> > > >
> > > > Gerlits AndrXs wrote:
> > > > >I was surprised to see that the getColumnLabel method in the
> > > > >ResultSetMetaData object returns the name of the column instead of
> the
> > > > >comment (when available).
> > > > >
> > > > >The documentation says that the method:
> > > > >"Gets the designated column's suggested title for use in printouts
> and
> > > > >displays."
> > > > >
> > > > >Any thoughts on that?
> > > > >
> > > > >I'd do it if you guys agree.
> > > > >
> > > > >Regards
> > > > >Andras Gerlits
> > > > >
> > > > >---------------------------(end of
> broadcast)---------------------------
> > > > >TIP 1: subscribe and unsubscribe commands go to
> majordomo(at)postgresql(dot)org
> > > > >
> > > >
> > > >
> > > >
> > > > ---------------------------(end of
> broadcast)---------------------------
> > > > TIP 3: if posting/reading through Usenet, please send an appropriate
> > > > subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> > > > message can get through to the mailing list cleanly
> > --
> > Dave Cramer <Dave(at)micro-automation(dot)net>
> >
>
> --
> Dror Matalon
> Zapatec Inc
> 1700 MLK Way
> Berkeley, CA 94709
> http://www.zapatec.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
--
Dave Cramer <Dave(at)micro-automation(dot)net>
From | Date | Subject | |
---|---|---|---|
Next Message | Matt Mello | 2003-01-26 21:42:01 | Re: getTableName |
Previous Message | Ray Madigan | 2003-01-26 19:21:38 | Re: getTableName |