postgres-async-driver icon indicating copy to clipboard operation
postgres-async-driver copied to clipboard

Row abstraction hides useful information

Open ratamaa opened this issue 7 years ago • 0 comments

Row interface does not currently provide

  • Number of columns in the row (so you could iterate over them when e.g. selecting *)
  • Names of columns (this information could be easily made available, preferably in the index order)
  • Types of columns (now you have to know them beforehand, which narrows the applicable use cases of this generic driver) E.g. the Postgres type integer could be fine but also the Oid could work (if the id field had getter). If you don't want to expose the Postgres-specific types, also the standard java.sql.Types integer (see https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java#L68-L94 ) could work.

It is also currently quite impossible to get this information even if you cast Row into PgRow since PgColumn is package private. Could it be public?

ratamaa avatar Dec 11 '17 20:12 ratamaa