Re: isNumeric function?
От | Arguile |
---|---|
Тема | Re: isNumeric function? |
Дата | |
Msg-id | 1090962521.20911.13733.camel@broadswd.local обсуждение исходный текст |
Ответ на | isNumeric function? (Jerry LeVan <jerry.levan@eku.edu>) |
Список | pgsql-general |
On Mon, 2004-07-26 at 09:52, Jerry LeVan wrote: > Is there a (relatively) simple way to tell if a column > is a "numeric" type other than comparing against the > seven or so oids which may or may not be the complete > list of things genererally considered to be numeric? > > I need this info to determine whether or not to justify > left or right in a data display. No, in fact it's more complicated than your example. You'd also want to consider which type a domain maps down to. There really isn't anything you can do to know if an extended type is a simple numeric (without running a regex on all the output data -- which is beyond icky). For formatting you'd probably not want to consider composite types or arrays as numeric even if they're totally composed of a builtin numeric base type. So, in addition to keeping a list of "pg_type.typname"s you consider numeric, you'd also want UNION "pg_type.typbasetype" WHERE "pg_type.typtype" = 'd' among some other restrictions. See http://www.postgresql.org/docs/7.4/static/catalog-pg-type.html for more info. As you said this was in an application, your DB driver may automatically map output types to SQL defined ones. If this is the case you might consider just relying on your driver's mapping.
В списке pgsql-general по дате отправления: