[PATCH] [REVIEW:3-5] PostgreSQL getColumns()

Lionel Elie Mamane lionel at mamane.lu
Mon Feb 13 09:08:53 PST 2012


On Mon, Feb 13, 2012 at 05:39:51PM +0100, Radek Doulik wrote:

> looks OK to me. I have cherry-picked it from master, because the
> attached patch didn't apply.

Oh, sorry, some difference between my work tree and pristine
libreoffice-3-5 must have made a mess.

The "sorted by concatenation" problem is commit
0adf5eed03d7a0f14d73c23bceb13b7a8cc693e4 in master, but was grouped in
my patch. Could you please cherry-pick it, too? Thanks.

> On Thu, 2012-02-09 at 19:27 +0100, Lionel Elie Mamane wrote:
>> getColumns() is a XDatabaseMetadata interface function to get the list
>> of columns of a table and info on these columns.

>> The PostgreSQL-SDBC implementation in 3.5.0 has a couple of bugs fixed
>> by the attached patch.

>>  - If the table previously had a column that has since been dropped
>>    (removed), the numbering of the columns has a hole, and in some
>>    circumstances the dropped column is still shown by getColumns().

>>  - Entries were sorted by the concatenation (?) of schema name, table
>>    name, column name. In rare cases, this could lead to wrong order,
>>    and is slower anyway. Example:

>>    library, book, bookID
>>    library, bookShelf, bookShelfID
>>    library, book, XID

>>    is sorted in this order by "concatenation", but in this (correct) order
>>    when sorting by column:

>>    library, book, bookID
>>    library, book, XID
>>    library, bookShelf, bookShelfID

>>    "||" is the SQL string concatenation operator.

>> I don't have a smoking gun fdo# of a "point and click user"-visible
>> bug of this, partially because our internal code is suspicious about
>> some of this data... See lcl_sanitizeColumnDescs in
>> connectivity/source/commontools/TTableHelper.cxx.

>> But I consider Base also as a programming platform,
>> user code (scripts) is allowed to call any function in
>> XDatabaseMetadata with any arguments, and giving a wrong result (data)
>> back is a bug in itself.



More information about the LibreOffice mailing list