Unable to cast object of type 'System.Byte[]' to type 'System.IConvertible'.Couldn't store <System.Byte[]> in relexternid Column. Expected type is Int32


Select * from pg_class results in the below error:

Unable to cast object of type 'System.Byte[]' to type 'System.IConvertible'.Couldn't store <System.Byte[]> in relexternid Column. Expected type is Int32



Use the below query instead:

SELECT relname
      , relnamespace
      , reltype
      , relowner
      , relam
      , relfilenode
      , reltablespace
      , relpages
      , reltuples
      , reltoastrelid
      , reltoastidxid
      , relhasindex
      , relisshared
      , relkind
      , relnatts
      , relexternid::BIGINT
      , relisreplicated
      , relispinned
      , reldiststyle
      , relprojbaseid
      , relchecks
      , reltriggers
      , relukeys
      , relfkeys
      , relrefs
      , relhasoids
      , relhaspkey
      , relhasrules
      , relhassubclass
      , relacl
 FROM pg_class;


Have more questions? Submit a request


  • 0
    Nathan Griffiths

    This is still an issue as of June 2017...

Please sign in to leave a comment.

** Aginity, Inc.’s Provision of Scripts and Similar Materials at Help Desk Center. For the convenience of Aginity Amp™ clients, we provide code snippets, scripts and similar materials at this Help Desk Center. Such materials are reference materials provided for illustration purposes only. These are intended to serve as an example for self-service clients and are generally geared to respond to common questions asked by similar clients. Such materials constitute Aginity’s intellectual property. Aginity Amp clients and their authorized users are permitted to use these materials in connection with their software license and/or subscription of Aginity Amp. Nothing herein shall limit Aginity’s right to use, develop, enhance, modify or market any of these materials as part of its business. These materials are not formally supported by Aginity or its affiliates. Usage of these materials does not guarantee any specific results, uptime, performance or error-free operation. Aginity disclaims all warranties of any kind, whether express, implied, statutory or otherwise, including any implied warranty of merchantability or fitness for a particular purpose.

Powered by Zendesk