# SQL query from Logstash causes an error PGobject

**URL:** <https://discuss.elastic.co/t/sql-query-from-logstash-causes-an-error-pgobject/138648>\
**Category:** Logstash\
**Created:** [July 5, 2018, 6:55am UTC](https://discuss.elastic.co/t/sql-query-from-logstash-causes-an-error-pgobject/138648 "2018-07-05T06:55:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Igorr](https://avatars.discourse-cdn.com/v4/letter/i/77aa72/32.png) [@Igorr](https://discuss.elastic.co/u/Igorr)\
**Post date:** [July 5, 2018, 6:55am UTC](https://discuss.elastic.co/t/sql-query-from-logstash-causes-an-error-pgobject/138648/1 "2018-07-05T06:55:54Z")

</div>

Logstash passes a request type:

_`SELECT * from dbmon_stat_activity()`_

I get an error in the log:

`_[2018-07-02T14:00:00,384][WARN][logstash.inputs.jdbc] Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::OrgLogstash::MissingConverterException: Missing Converter handling for full class name=org.postgresql.util.PGobject, simple name=PGobject>}_`

The function that is called by this query:

```
CREATE OR REPLACE FUNCTION public.dbmon_stat_activity()
RETURNS SETOF pg_stat_activity
     LANGUAGE plpgsql
     SECURITY DEFINER
    AS $function$
    DECLARE
     rcrd RECORD;
    BEGIN
      FOR rcrd IN SELECT * FROM pg_stat_activity
      LOOP
        RETURN NEXT rcrd;
      END LOOP;
      RETURN;
    END;
    $function$

```

In accordance with what is written [here](https://discuss.elastic.co/t/missing-converter-handling-for-full-class-error/113630) and [here](https://discuss.elastic.co/t/how-to-convert-uuid-into-string-in-logstash/127069) I need to select the type of data in the table.  
How can this be done in a function or is it necessary to edit a table?

If you manually execute this query, then everything works without errors.  
Is this error related to JDBC?  
Are there any alternative versions of the driver?

Thank you in advance

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 9, 2018, 11:36am UTC](https://discuss.elastic.co/t/sql-query-from-logstash-causes-an-error-pgobject/138648/2 "2018-07-09T11:36:02Z")

</div>

One of the columns returned by the query has a data type that Logstash doesn't know how to handle. You can type cast that column to a recognized data type (e.g. VARCHAR) in the query's SELECT statement.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 6, 2018, 2:31pm UTC](https://discuss.elastic.co/t/sql-query-from-logstash-causes-an-error-pgobject/138648/4 "2018-08-06T14:31:24Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
