Skip to content

Commit

Permalink
Merge pull request #4303 from soerenwolfers/patch-67
Browse files Browse the repository at this point in the history
Update postgresql_compatibility.md
  • Loading branch information
szarnyasg authored Dec 8, 2024
2 parents 84c2283 + ca3a465 commit 0b7e371
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions docs/sql/dialect/postgresql_compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@ SELECT 1 / 2 AS x;

PostgreSQL returns:

```text
x
---
0
(1 row)
```
<div class="narrow_table"></div>

| x |
| ---: |
| 0 |

DuckDB returns:

<div class="narrow_table"></div>

| x |
| ---: |
| 0.5 |
Expand All @@ -63,6 +64,8 @@ To perform integer division in DuckDB, use the `//` operator:
SELECT 1 // 2 AS x;
```

<div class="narrow_table"></div>

| x |
| ---: |
| 0 |
Expand All @@ -85,6 +88,9 @@ ERROR: UNION types boolean and integer cannot be matched

DuckDB performs an enforced cast, therefore, it completes the query and returns the following:


<div class="narrow_table"></div>

| x |
| ---: |
| 1 |
Expand Down Expand Up @@ -162,14 +168,11 @@ SELECT 1 == 1 AS t;

DuckDB returns:

```text
┌─────────┐
│ t │
│ boolean │
├─────────┤
│ true │
└─────────┘
```
<div class="narrow_table monospace_table"></div>

| t |
| ---: |
| true |

Postgres returns:

Expand Down Expand Up @@ -219,7 +222,6 @@ PostgreSQL returns an error on the last statement:
```console
ERROR: type "mytype" does not exist
LINE 1: CREATE TABLE myschema.mytable (v mytype);
^
```

DuckDB runs the statement and creates the table successfully, confirmed by the following query:
Expand All @@ -228,11 +230,9 @@ DuckDB runs the statement and creates the table successfully, confirmed by the f
DESCRIBE myschema.mytable;
```

```text
┌─────────────┬──────────────────┬─────────┬─────────┬─────────┬─────────┐
│ column_name │ column_type │ null │ key │ default │ extra │
│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │
├─────────────┼──────────────────┼─────────┼─────────┼─────────┼─────────┤
│ v │ ENUM('as', 'df') │ YES │ NULL │ NULL │ NULL │
└─────────────┴──────────────────┴─────────┴─────────┴─────────┴─────────┘
```
<div class="narrow_table monospace_table"></div>

| column_name | column_type | null | key | default | extra |
|-------------|------------------|------|------|---------|-------|
| v | ENUM('as', 'df') | YES | NULL | NULL | NULL |

0 comments on commit 0b7e371

Please sign in to comment.