Re: getColumnLabel return value
От | Barry Lind |
---|---|
Тема | Re: getColumnLabel return value |
Дата | |
Msg-id | 3DFE22C8.7000006@xythos.com обсуждение исходный текст |
Ответ на | getColumnLabel return value ("Gerlits András" <gerlits@neotek.hu>) |
Ответы |
getTableName
|
Список | pgsql-jdbc |
Actually I would say that we currently do return the label. Since we are dealing with result sets here, we are dealing with queries and not necessarily tables. Consider the following query: select a.FOO as bar1, b.FOO as bar2 from BAZ1 a, BAZ2 b where a.X = b.X will return the following information: getColumnName(1) -> bar1 getColumnLabel(1) -> bar1 getColumnName(2) -> bar2 getColumnLabel(2) -> bar2 This is a limitation of the information the driver gets back from the server, it only returns the 'label' which the driver then uses for both columnname and label. Which usually is the columnname (unless you alias it as above). For fun consider the following query: select 'a message' as message, FOO as bar from BAZ getColumnName(1) -> ??? what should this be since there is no column getColumnLabel(1) -> message getColumnName(2) -> should be foo if we were given that information from the server, but currently is bar getColumnLabel(2) -> bar 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. 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@postgresql.org >
В списке pgsql-jdbc по дате отправления: