Minor SQL slipup in PgTableColumnsReader for PostGIS Provider

1 message Options
Embed this post
Permalink
Mike Toews

Minor SQL slipup in PgTableColumnsReader for PostGIS Provider

Reply Threaded More More options
Print post
Permalink
Hi all,

I was looking through the source for the PostGIS provider, and although
I don't understand C++, I can understand SQL. I noticed a minor error
for PgTableColumnsReader::Open() in the statement:
http://trac.osgeo.org/fdo/browser/trunk/Providers/PostGIS/Src/Provider/PgTableColumnsReader.cpp#L234

The join with pg_attrdef requires two conditions:
LEFT OUTER JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum =
d.adnum

The current version uses only the first condition in the JOIN, which
repeats the first non-unique join down the defaultval column in the
query result (for example, each row from the result has
"nextval('mytable_gid_seq'::regclass)" regardless of the column).

The second thing that I noticed about this query is each column name is
repeated several times if the table has indexes. I'm not sure if this is
intentional, but I also don't know how this table is used by FDO. For my
tables, I see each column repeated anywhere between 2 and 8 times.

+mt
_______________________________________________
fdo-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-internals