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
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).