Обсуждение: Updatable/Read-only columns

Поиск
Список
Период
Сортировка

Updatable/Read-only columns

От
Michaël Michaud
Дата:
Hi,

First of all, I'm very happy with postgresql and its jdbc driver.
Recently, I wanted to access updatable views and know if some columns
are read-only (like columns defined by an operation)

I looked into DatabaseMataData.getColumns, but the
24.IS_GENERATEDCOLUMN attribute, defines in java7/jdbc4.1 is not
availiable in the current driver which has only 23 attributes (anyway,
I'm not sure what this attribute is supposed to return)

I also looked into ResultSetMetaData.isReadOnly(), but it always return
false. Comments say that "we would have to check the GRANT/REVOKE stuff
for this to be effective". A first step could be to return if the column
cannot be updatable for anybody

Maybe information_schema.columns.isupdatable column could be of any help
to get this information ?

Best regards,

Michaël


Re: Updatable/Read-only columns

От
Vladimir Sitnikov
Дата:
Hi,

Pull requests are welcome.

I think the way to go is to update
org.postgresql.jdbc.PgResultSetMetaData#fetchFieldMetaData with an
expression that is used in information_schema.columns.is_updatable.
TravisCI validates all the supported versions, thus we'll know if the
change requires some version-specific tweaks.

Vladimir