[fdo-internals] Minor SQL slipup in PgTableColumnsReader for PostGIS Provider

Michael Toews mwtoews at sfu.ca
Sat Sep 27 22:21:26 EDT 2008

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:

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

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.


More information about the fdo-internals mailing list