Given: We are accessing a PostgreSQL DB from a VB NET application. When the query completes the DB rows are delivered in a VB NET DataTable
. The Postgre DB geom column is in the format of System.Bytes[]
(a byte array). I can convert the Byte array to the WKB format but converting the WBK to WKT format appears more complex. Hence, I was thinking I could return the geom col results as WKT.
My issue with this is I cannot use a SELECT *
in the query to the DB. It seems I will need to parameterize ALL the columns in the SELECT
command since I want the geom column in a DIFFERENT format.
Obvious Query:
SELECT * FROM temporary.summmarytable WHERE conditions = 'xxxxx'
has to become:
SELECT col1, col2 , col3. col4....ST_AsText(geom) WHERE condition = 'xxxxx'
I'm not a fan of long paramterized column lists as shown above. Is there a way to reset the geom output within a PostgreSQL function.
SELECT *, ST_AsText(geom) AS wkt_geom FROM ...
? Not supported?RETURNS TABLE (<columns COLTYPES>)
, defineIN
andOUT
columns in the function signature and useRETURNS SETOF RECORD AS
(or you will have to specify columns each time you call the function -> large pain in the) or you can even define your own composite type with those columns and use your initial return statement with its name...either way, you will have to write them down once. I recommend theRETURN TABLE ...
syntax.