Github user bolkedebruin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19911#discussion_r155336986
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala ---
    @@ -100,5 +100,5 @@ private object PostgresDialect extends JdbcDialect {
     
       }
     
    -  override def isCascadingTruncateTable(): Option[Boolean] = Some(true)
    +  override def isCascadingTruncateTable(): Option[Boolean] = Some(false)
    --- End diff --
    
    ```
    airflow=# CREATE TABLE products (
    airflow(#     product_no integer PRIMARY KEY,
    airflow(#     name text,
    airflow(#     price numeric
    airflow(# );
    CREATE TABLE
    airflow=#
    airflow=# CREATE TABLE orders (
    airflow(#     order_id integer PRIMARY KEY,
    airflow(#     product_no integer REFERENCES products (product_no),
    airflow(#     quantity integer
    airflow(# );
    CREATE TABLE
    
    airflow=# insert into products VALUES (1, 1, 1);
    INSERT 0 1
    airflow=# insert into orders VALUES (1,1,1);
    INSERT 0 1
    airflow=# select * from products;
     product_no | name | price
    ------------+------+-------
              1 | 1    |     1
    (1 row)
    
    airflow=# select * from orders;
     order_id | product_no | quantity
    ----------+------------+----------
            1 |          1 |        1
    (1 row)
    
    airflow=# truncate orders;
    TRUNCATE TABLE
    airflow=# select * from products;
     product_no | name | price
    ------------+------+-------
              1 | 1    |     1
    (1 row)
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to