docstr: This is currently the only clean solution that we have found so far.
  Reference to Postgres API: https://www.psycopg.org/docs/cursor.html#fetch
  
  In short, currently there is no very clean programming way to differentiate
  CREATE, INSERT, SELECT. CREATE and INSERT do not return any result, so calling
  fetchall() on those will yield a programming error. Cursor has an attribute
  rowcount, but it indicates # of rows that are affected. In that case, for both
  INSERT and SELECT rowcount is not 0, so we also cannot use this API to
  differentiate INSERT and SELECT.
docstr_tok: ["This","is","currently","the","only","clean","solution","that","we","have","found","so","far",".","Reference","to","Postgres","API",":","https",":","\/\/www.psycopg.org\/docs\/cursor.html","#","fetch","In","short",",","currently","there","is","no","very","clean","programming","way","to","differentiate","CREATE",",","INSERT",",","SELECT",".","CREATE","and","INSERT","do","not","return","any","result",",","so","calling","fetchall","(",")","on","those","will","yield","a","programming","error",".","Cursor","has","an","attribute","rowcount",",","but","it","indicates","#","of","rows","that","are","affected",".","In","that","case",",","for","both","INSERT","and","SELECT","rowcount","is","not","0",",","so","we","also","can","not","use","this","API","to","differentiate","INSERT","and","SELECT","."]
code: def _fetch_results_as_df(self, cursor):
      """
      This is currently the only clean solution that we have found so far.
      Reference to Postgres API: https://www.psycopg.org/docs/cursor.html#fetch
  
      In short, currently there is no very clean programming way to differentiate
      CREATE, INSERT, SELECT. CREATE and INSERT do not return any result, so calling
      fetchall() on those will yield a programming error. Cursor has an attribute
      rowcount, but it indicates # of rows that are affected. In that case, for both
      INSERT and SELECT rowcount is not 0, so we also cannot use this API to
      differentiate INSERT and SELECT.
      """
      try:
          res = cursor.fetchall()
          res_df = pd.DataFrame(
              res,
              columns=[desc[0].lower() for desc in cursor.description],
          )
          return res_df
      except psycopg2.ProgrammingError as e:
          if str(e) == "no results to fetch":
              return pd.DataFrame({"status": ["success"]})
          raise e
  
file_path: evadb/evadb/third_party/databases/postgres/postgres_handler.py
imports: import numpy
  import pandas
  import psycopg2
  from evadb.third_party.databases.types import DBHandler, DBHandlerResponse, DBHandlerStatus
label_desc: Use image node_id 8 for calling the PostgresHandler obj's underlying member method code with example usage: obj._fetch_results_as_df(cursor) and returns: res_df, pd