class_docstr: This handler handles connection and execution of the PostgreSQL statements.
docstr: Receive SQL query and runs it
  :param query: The SQL query to run in PostgreSQL
  :return: returns the records from the current recordset
docstr_tok: ["Receive","SQL","query","and","runs","it",":","param","query",":","The","SQL","query","to","run","in","PostgreSQL",":","return",":","returns","the","records","from","the","current","recordset"]
code: def native_query(self, query: str) -> Response:
      """
      Receive SQL query and runs it
      :param query: The SQL query to run in PostgreSQL
      :return: returns the records from the current recordset
      """
      need_to_close = self.is_connected is False
  
      connection = self.connect()
      with connection.cursor() as cur:
          try:
              cur.execute(query)
              if (
                  ExecStatus(cur.pgresult.status)
                  == ExecStatus.COMMAND_OK
              ):
                  response = Response(RESPONSE_TYPE.OK)
              else:
                  result = cur.fetchall()
                  df = DataFrame(
                      result, columns=[x.name for x in cur.description]
                  )
                  self._cast_dtypes(df, cur.description)
                  response = Response(RESPONSE_TYPE.TABLE, df)
              connection.commit()
          except Exception as e:
              logger.error(
                  f"Error running query: {query} on {self.database}!"
              )
              response = Response(
                  RESPONSE_TYPE.ERROR,
                  error_code=0,
                  error_message=str(e),
              )
              connection.rollback()
  
      if need_to_close is True:
          self.disconnect()
  
      return response
  
imports: from collections import OrderedDict
  import psycopg
  from psycopg.postgres import types
  from psycopg.pq import ExecStatus
  from pandas import DataFrame
  from mindsdb_sql import parse_sql
  from mindsdb_sql.render.sqlalchemy_render import SqlalchemyRender
  from mindsdb_sql.parser.ast.base import ASTNode
  from mindsdb.integrations.libs.base import DatabaseHandler
  from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE
  from mindsdb.utilities import log
  from mindsdb.integrations.libs.response import HandlerStatusResponse, HandlerResponse, RESPONSE_TYPE
  import mindsdb.utilities.profiler
label_desc: Use image node_id 7 for calling the PostgresHandler obj's underlying member method code with example usage: obj.native_query(query) and returns: response