# Postgresql -\> Jdbc input plugin -\> logstash - ERROR: relation does not exist

**URL:** <https://discuss.elastic.co/t/postgresql-jdbc-input-plugin-logstash-error-relation-does-not-exist/274296>\
**Category:** Logstash\
**Created:** [May 28, 2021, 7:33am UTC](https://discuss.elastic.co/t/postgresql-jdbc-input-plugin-logstash-error-relation-does-not-exist/274296 "2021-05-28T07:33:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FALEN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/falen/32/82754_2.png) [@FALEN](https://discuss.elastic.co/u/FALEN)\
**Post date:** [May 28, 2021, 7:33am UTC](https://discuss.elastic.co/t/postgresql-jdbc-input-plugin-logstash-error-relation-does-not-exist/274296/1 "2021-05-28T07:33:51Z")

</div>

Hello everyone,

It seems im missing something, but couldn't found anything related to this. Im using jdbc input plugin to collect some data from postgresql db.

> _[2021-05-28T03:24:12,032][ERROR][logstash.inputs.jdbc][main][_\*\*\*\*\*\*\*\*\*\*\*] Java::OrgPostgresqlUtil::PSQLException: ERROR: relation "pg\_stat\_statements" does not exist Position: 58:  
> select pu.usename, pss.query, pss.calls, pss.”rows”  
> from pg\_stat\_statements pss, pg\_user pu  
> where pss.userid=pu.usesysid  
> order by 3 desc;
> 
> _[2021-05-28T03:24:12,109][WARN][logstash.inputs.jdbc][main][_\*\*\*\*\*\*\*\*\*\*_] Exception when executing JDBC query {:exception=\>"Java::OrgPostgresqlUtil::PSQLException: ERROR: relation "pg\_stat\_statements" does not exist\n Position: 58"}_

```auto
**configuration**
input {
jdbc {
jdbc_connection_string => "jdbc:postgresql://database.com:5432/mydatabase"
jdbc_user => "user"
jdbc_password => "password"
jdbc_driver_class => "org.postgresql.Driver"
statement_filepath => "statementpath.sql"
sql_log_level => "warn"
}
}

**statement**
select pu.usename, pss.query, pss.calls, pss.”rows”
from pg_stat_statements pss, pg_user pu
where pss.userid=pu.usesysid
order by 3 desc;

```

btw; Does this error message come from postgresql or jdbc input plugin does generate it?

---

<div class="post-metadata">

**Author:** ![FALEN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/falen/32/82754_2.png) [@FALEN](https://discuss.elastic.co/u/FALEN)\
**Post date:** [May 28, 2021, 3:03pm UTC](https://discuss.elastic.co/t/postgresql-jdbc-input-plugin-logstash-error-relation-does-not-exist/274296/2 "2021-05-28T15:03:06Z")

</div>

fixed this by using "public.pg\_stat\_statements"

---

<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:** [June 25, 2021, 3:03pm UTC](https://discuss.elastic.co/t/postgresql-jdbc-input-plugin-logstash-error-relation-does-not-exist/274296/3 "2021-06-25T15:03:20Z")

</div>

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