pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Why are clobs always "0"
3+ messages / 3 participants
[nested] [flat]

* Why are clobs always "0"
@ 2019-12-01 17:31 Arnie Morein <arnie.morein@mac.com>
  2019-12-01 18:21 ` Re: Why are clobs always "0" Adrian Klaver <adrian.klaver@aklaver.com>
  2019-12-01 21:13 ` Re: Why are clobs always "0" Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 2 replies; 3+ messages in thread

From: Arnie Morein @ 2019-12-01 17:31 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

I have tested the most recent driver in three different SQL IDEs, and 
now with an application I'm writing that uses JDBC metadata, the 
comment on a field definition also isn't available as a string value.

The only thing I ever see regarding data type "text" field values are 
either a 0 or a 1; neither of which applies.

So why is this happening, even from the JDBC metadata results as well?

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Why are clobs always "0"
  2019-12-01 17:31 Why are clobs always "0" Arnie Morein <arnie.morein@mac.com>
@ 2019-12-01 18:21 ` Adrian Klaver <adrian.klaver@aklaver.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Adrian Klaver @ 2019-12-01 18:21 UTC (permalink / raw)
  To: Arnie Morein <arnie.morein@mac.com>; pgsql-general@lists.postgresql.org

On 12/1/19 9:31 AM, Arnie Morein wrote:
> I have tested the most recent driver in three different SQL IDEs, and 
> now with an application I'm writing that uses JDBC metadata, the comment 
> on a field definition also isn't available as a string value.
> 
> The only thing I ever see regarding data type "text" field values are 
> either a 0 or a 1; neither of which applies.
> 
> So why is this happening, even from the JDBC metadata results as well?


You are going to have to be more specific:

1) You refer to clob, but the clob datatype is not supported:
https://www.postgresql.org/docs/11/unsupported-features-sql-standard.html
So what are you referring to?

2) Comment on field definition is what exactly?

3) How are you fetching the metadata?


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Why are clobs always "0"
  2019-12-01 17:31 Why are clobs always "0" Arnie Morein <arnie.morein@mac.com>
@ 2019-12-01 21:13 ` Thomas Kellerer <spam_eater@gmx.net>
  1 sibling, 0 replies; 3+ messages in thread

From: Thomas Kellerer @ 2019-12-01 21:13 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Arnie Morein schrieb am 01.12.2019 um 18:31:
> I have tested the most recent driver in three different SQL IDEs, and
> now with an application I'm writing that uses JDBC metadata, the
> comment on a field definition also isn't available as a string
> value.
>
> The only thing I ever see regarding data type "text" field values are
> either a 0 or a 1; neither of which applies.
>
> So why is this happening, even from the JDBC metadata results as
> well?

The Postgres JDBC driver does not have any problems with the "text"
data type, neither with reporting it properly through DatabaseMetaData
(it's reported as Types.VARCHAR) nor with retrieving values from
such a column.

The column size for such a column is reported as 2147483647

Column comments are reliably returned in the column "REMARKS" in the
result of DatabaseMetaData.getColumns()

Given the following table:

     create table test (data text);
     comment on column test.data is 'The text column';

then the following Java code:

     ResultSet rs = connection.getDatabaseMetaData().getColumn(null, "public", "test", "%");
     rs.next();
     System.out.println("column_name: " + rs.getString("COLUMN_NAME"));
     System.out.println("column_size: " + rs.getInt("COLUMN_SIZE"));
     System.out.println("data_type: " + rs.getInt("DATA_TYPE"));
     System.out.println("remarks: " + rs.getString("REMARKS"));

will output:

   column_name: data
   column_size: 2147483647
   data_type: 12
   remarks: The text column

With 12 being the value of java.sql.Types.VARCHAR

Thomas






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-12-01 21:13 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-01 17:31 Why are clobs always "0" Arnie Morein <arnie.morein@mac.com>
2019-12-01 18:21 ` Adrian Klaver <adrian.klaver@aklaver.com>
2019-12-01 21:13 ` Thomas Kellerer <spam_eater@gmx.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox