Daniel van der Ende created SPARK-22729:
-------------------------------------------

             Summary: Add getTruncateQuery to JdbcDialect
                 Key: SPARK-22729
                 URL: https://issues.apache.org/jira/browse/SPARK-22729
             Project: Spark
          Issue Type: New Feature
          Components: SQL
    Affects Versions: 2.2.1
            Reporter: Daniel van der Ende


In order to enable truncate for PostgreSQL databases in Spark JDBC, a change is 
needed to the query used for truncating a PostgreSQL table. By default, 
PostgreSQL will automatically truncate any descendant tables if a TRUNCATE 
query is executed. As this may result in (unwanted) side-effects, the query 
used for the truncate should be specified separately for PostgreSQL, specifying 
only to TRUNCATE a single table.

This will also resolve SPARK-22717

See PostgreSQL documentation 
https://www.postgresql.org/docs/current/static/sql-truncate.html

This change will still not let users truncate a table with cascade enabled 
(which would also truncate tables with foreign key constraints to the table).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to