Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PostgreSQL-Compatibility, SQL Feature Coverage, PG Extensions #11602

Merged
merged 31 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f73e0fd
Create PostgreSQL-Compatibility
ymahajan Feb 27, 2022
23bca4b
Create postgresql-compatibility.md
ymahajan Feb 27, 2022
ccdd882
Create sql-feature-support.md
ymahajan Feb 27, 2022
8dd999b
Delete PostgreSQL-Compatibility
ymahajan Feb 27, 2022
944ae38
Update sql-feature-support.md
ymahajan Feb 28, 2022
2519f96
Update sql-feature-support.md
ymahajan Feb 28, 2022
32b8290
Update sql-feature-support.md
ymahajan Feb 28, 2022
f59ecec
Update postgresql-compatibility.md
ymahajan Feb 28, 2022
6a10dd0
Update postgresql-compatibility.md
ymahajan Feb 28, 2022
f3b546f
Create pg-extensions.md
ymahajan Feb 28, 2022
7ffa7a2
Update postgresql-compatibility.md
ymahajan Feb 28, 2022
f71fb93
Update pg-extensions.md
ymahajan Mar 1, 2022
5042b4e
Update postgresql-compatibility.md
ymahajan Mar 1, 2022
b7b6d40
Update sql-feature-support.md
ymahajan Mar 1, 2022
3477ba6
Update docs/content/latest/explore/ysql-language-features/postgresql-…
ymahajan Mar 14, 2022
c9cc5a8
Update docs/content/latest/explore/ysql-language-features/postgresql-…
ymahajan Mar 14, 2022
3e3e2b2
Update docs/content/latest/explore/ysql-language-features/sql-feature…
ymahajan Mar 14, 2022
53adcb6
Update docs/content/latest/api/ysql/pg-extensions.md
ymahajan Mar 14, 2022
3eb0abf
Update docs/content/latest/api/ysql/pg-extensions.md
ymahajan Mar 14, 2022
12eee84
Update docs/content/latest/api/ysql/pg-extensions.md
ymahajan Mar 14, 2022
2d167f9
Update postgresql-compatibility.md
ymahajan Mar 14, 2022
f21be8b
Update sql-feature-support.md
ymahajan Mar 14, 2022
179b90f
Update sql-feature-support.md
ymahajan Mar 14, 2022
64f7d52
Update pg-extensions.md
ymahajan Mar 14, 2022
9c7343c
Create pg-extensions.md
ymahajan Mar 14, 2022
d8d95b5
Delete extensions.md
ymahajan Mar 15, 2022
dfe39db
Delete pg-extensions.md
ymahajan Mar 15, 2022
97b7639
Update pg-extensions.md
ymahajan Mar 15, 2022
aeb60be
Update sql-feature-support.md
ymahajan Mar 15, 2022
f346566
Delete YSQL-Features-Supported.md
ymahajan Mar 15, 2022
d973ec4
Update sql-feature-support.md
ymahajan Mar 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions docs/content/latest/api/ysql/pg-extensions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: PostgreSQL extensions
headerTitle: PostgreSQL extensions
linkTitle: PostgreSQL extensions
description: List of supported PostgreSQL extensions
summary: Reference for YSQL extensions
menu:
latest:
identifier: api-ysql-postgresql-extensions
parent: api-ysql
weight: 4400
isTocNested: true
showAsideToc: true
---

PostgreSQL provides a way to extend the functionality of a database by bundling SQL objects into a package and using them as a unit.
This page describes the PostgreSQL extensions and describes the extensions supported by YugabyteDB.


# PostgreSQL extensions supported by YugabyteDB
For information about using a specific extension, see the documentation link in one of the tables below.
Extension | Status | Description
-----------|-----------|---------
[fuzzystrmatch](https://www.postgresql.org/docs/current/fuzzystrmatch.html) | Bundled | The fuzzystrmatch module provides several functions to determine similarities and distance between strings.
[orafce](https://github.com/orafce/orafce)| Bundled |The orafce extension provides compatibility with Oracle functions and packages that are either missing or implemented differently in YugabyteDB and PostgreSQL. This compatibility layer can help you port your Oracle applications to YugabyteDB.
[pgcrypto](https://www.postgresql.org/docs/current/pgcrypto.html)| Bundled |The pgcrypto extension provides various cryptographic functions.
pg_stat_statements| |
pg_hint_plan| |
pgaudit| |
pg_stat_monitor| |
spi module| |
uuid_ossp| |
hstore| |
pg_trgm| |
postgres_fdw| |
file_fdw| |
sslinfo| |

## Using PostgreSQL extensions
You can install only the extensions that are supported by YugabyteDB.

Note: You can only install extensions on the primary instance, not the read replica. Once installed, the extension replicates to the read replica.

### Installing an extension
Before using an extension, install it:
In the ysql shell, run the CREATE EXTENSION command.
### Requirement for superuser privileges
Extensions can only be created by users that are part of the superuser role?

### Inter-database connections
The target instances for connections must be in the same VPC network as the connecting instance.

## Requesting support for a new extension
You cannot create your own extensions in YugabyteDB.

To request support for an extension, add a Me, too! vote for its issue in the Issue Tracker, or create a new issue there.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: PostgreSQL Compatibility
linkTitle: PostgreSQL Compatibility
description: Summary of YugabyteDB's PostgreSQL Compatibility
image: /images/section_icons/secure/create-roles.png
menu:
latest:
identifier: explore-ysql-postgresql-compatibility
parent: explore-ysql-language-features
weight: 70
isTocNested: true
showAsideToc: true
---
YugabyteDB is a PostgreSQL compatible distributed database that supports the majority of PostgreSQL syntax. This means that existing applications built on PostgreSQL can often be migrated to YugabyteDB without changing application code.

Since YugabyteDB is PostgreSQL compatible, it works with the majority of PostgreSQL database tools such as various language drivers, ORM tools, schema migration tools, and many more third-party database tools.

Since YugabyteDB is a distributed database, supporting all PostgreSQL features easily in a distributed system is not always feasible. This page documents the known list of differences between PostgreSQL and YugabyteDB. You need to consider these differences while porting an existing application to YugabyteDB.

## Unsupported PostgreSQL features
The following PostgreSQL features are not supported in YugabyteDB:
- Passimistic locking
- Table locks
- [Inheritance](https://www.postgresql.org/docs/11/tutorial-inheritance.html)
- Exclusion Constraints
- GiST indexes
- Kerberos/GSSAPI
- Events (Listen/Notify)
- Drop primary key
- XML Functions
- XA syntax

## Features that differ from PostgreSQL
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to me like the features that are under Going beyond SQL section: https://docs.yugabyte.com/latest/explore/ysql-language-features/. If that's the case, we may just need to link it to that page and not duplicate it to two pages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove this sub-section altogether, this doesn't have any concrete content yet.

- Tablespaces
- Logical replication is CDC
- Primary key (hash/range)
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
---
title: SQL Feature Support
linkTitle: SQL Feature Support
description: Summary of YugabyteDB's conformance to the SQL standard
image: /images/section_icons/secure/create-roles.png
menu:
latest:
identifier: explore-ysql-language-feature-support
parent: explore-ysql-language-features
weight: 50
isTocNested: true
showAsideToc: true
---
To understand which standard SQL features we support, refer below tables.

### Schema operations

Operation | Supported | Details
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try formatting your tables like this :

Operation Supported Documentation
Altering tables ALTER TABLE

I also think we can replace Details with Documentation.

-----------|-----------|---------
Altering tables | ✓ | [`ALTER TABLE` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/ddl_alter_table/)
Altering databases | ✓ | [`ALTER DATABASE` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/ddl_alter_db/)
Altering columns | ✗ |
Altering a column's data type | ✗ |
Adding columns | ✓ | [`ADD COLUMN` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/ddl_alter_table/#add-column-column-name-data-type-constraint-constraints)
Removing columns | ✓ | [`DROP COLUMN` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/ddl_alter_table/#drop-column-column-name-restrict-cascade)
Adding constraints | ✓ | [`ADD CONSTRAINT` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/ddl_alter_table/#add-alter-table-constraint-constraints)
Removing constraints | ✓ | [`DROP CONSTRAINT` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/ddl_alter_table/#drop-constraint-constraint-name-restrict-cascade)
Altering indexes | ✗ |
Adding indexes | ✓ | [`CREATE INDEX` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/ddl_create_index/)
Removing indexes | ✗ |
Altering a primary key | ✗ |
Adding user-defined schemas | ✓ | [`CREATE SCHEMA` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/ddl_create_schema/)
Removing user-defined schemas | ✗ |
Altering user-defined schemas | ✗ |

### Data types

Data type | Supported | Details
-----------|-----------|---------
`ARRAY` | ✓ | [Array documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_array/)
`BINARY` | ✓ | [Binary documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_binary/)
`BIT` | ✓ |
`BYTES` | ✓ |
`BOOLEAN` | ✓ | [Boolean documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_bool/)
`CHAR`, `VARCHAR`, `TEXT` | ✓ | [Character data types documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_character/)
`COLLATE` | ✓ | [Collate documentation](https://docs.yugabyte.com/latest/explore/ysql-language-features/advanced-features/collations/#root)
`DATE`, `TIME`, `TIMESTAMP`, `INTERVAL` | ✓ | [Date and time data types documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_datetime/)
`DEC`, `DECIMAL`, `NUMERIC` | ✓ | [ Fixed point numbers documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_numeric/#fixed-point-numbers)
`ENUM` | ✓ |[ENUM documentation](https://docs.yugabyte.com/latest/explore/ysql-language-features/data-types/#enumerations-enum-type)
`FLOAT`, `REAL`, `DOUBLE PRECISION` | ✓ | [Floating point numbers documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_numeric/)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`JSON`, `JSONB` | ✓ | [JSON data types documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_json/)
`MONEY` | ✓ | [Money data type documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_money/)
`SERIAL`, `SMALLSERIAL`, `BIGSERIAL`| ✓ | [Serial documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_serial/)
`SET`| ✗ |
`SMALLINT, INT, INTEGER, BIGINT` | ✓ | [Integers documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_numeric/)
`INT4RANGE`, `INT8RANGE`, `NUMRANGE`, `TSRANGE`, `TSTZRANGE`, `DATERANGE` | ✓ | [Range data types documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_range/)
`UUID` | ✓ | [UUID documentation](https://docs.yugabyte.com/latest/api/ysql/datatypes/type_uuid/)
`XML`| ✗ |
`TSVECTOR` | ✓ |
UDT | ✓ |

### Indexes

Component | Supported | Details
-----------|-----------|---------
Indexes | ✓ | [Indexes documentation](https://docs.yugabyte.com/latest/explore/indexes-constraints/overview/)
GIN indexes | ✓ | [GIN Indexes documentation](https://docs.yugabyte.com/latest/explore/indexes-constraints/gin/)
Partial indexes | ✓ | [Partial indexes documentation](https://docs.yugabyte.com/latest/explore/indexes-constraints/partial-index-ysql/)
Expression indexes | ✓ | [Expression indexes](https://docs.yugabyte.com/latest/explore/indexes-constraints/expression-index-ysql/)
Multi-column indexes | ✗ |
Covering indexes | ✗ |
Spatial indexes | ✗ |
Multiple indexes per query | ✗ |
Full-text indexes | ✗ |
Prefix indexes | ✗ | Implement using [Expression indexes](https://docs.yugabyte.com/latest/explore/indexes-constraints/expression-index-ysql/)
Hash indexes | ✓ |
GiST indexes | ✗ |
BRIN indexes | ✗ |

### Constraints

Feature | Supported | Details
-----------|-----------|---------
Check | ✓ | [Check documentation](https://docs.yugabyte.com/latest/explore/indexes-constraints/other-constraints/#check-constraint)
Unique | ✓ | [Unique documentation](https://docs.yugabyte.com/latest/explore/indexes-constraints/other-constraints/#unique-constraint)
Not Null | ✓ | [Not Null documentation](https://docs.yugabyte.com/latest/explore/indexes-constraints/other-constraints/#not-null-constraint)
Primary Key | ✓ | [Primary Key documentation](https://docs.yugabyte.com/latest/explore/indexes-constraints/primary-key-ysql/)
Foreign Key | ✓ | [Foreign Key documentation](https://docs.yugabyte.com/latest/explore/indexes-constraints/foreign-key-ysql/)
Default Value | ✗ |

### Transactions

Feature | Supported | Details
-----------|-----------|---------
Transactions | ✓ | [Transactions documentation](https://docs.yugabyte.com/latest/explore/transactions/)
`BEGIN` | ✓ | [`BEGIN` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/txn_begin/)
`COMMIT` | ✓ | [`COMMIT` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/txn_commit/)
`ROLLBACK` | ✓ | [`ROLLBACK` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/txn_rollback/)
`SAVEPOINT` | ✓ | [`SAVEPOINT` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/savepoint_create/)
`ROLLBACK TO SAVEPOINT` | ✓ | [`ROLLBACK TO SAVEPOINT` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/savepoint_create/)

### Roles and Permissions

Component | Supported | Details
-----------|-----------|---------
Users | ✓ |
Roles | ✓ |
Object ownership | ✓ |
Privileges | ✓ |
Default privileges | ✗ |
RLS/CLS | |

### Advanced statements (other than common statementes)

Statement | Supported | Details
-----------|-----------|---------
`SELECT INTO` | ✗|
`SELECT FOR UPDATE` | ✗ |
`EXPLAIN` | ✓ | [`EXPLAIN` documentation](https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/perf_explain)

### Clauses

Clause | Supported | Details
-----------|-----------|---------
`LIMIT` | ✗ |
`LIMIT` with `OFFSET` | ✗ |
`RETURNING` | ✗ |

### Table expressions

Component | Supported | Details
-----------|-----------|---------
Table and View references | ✓ |
`AS` in table expressions | ✓ |
`JOIN` (`INNER`, `LEFT`, `RIGHT`, `FULL`, `CROSS`) |✓ |
Sub-queries as table expressions | ✓ |
Table generator functions | ✓ |
`WITH ORDINALITY` | ✓ |

### Scalar expressions and Boolean formulas

Component | Supported | Details
-----------|-----------|---------
Common functions | ✓ |
Common operators | ✓ |
`IF`/`CASE`/`NULLIF` | ✓ |
`COALESCE`/`IFNULL` | ✓ |
`AND`/`OR` | ✓ |
`LIKE`/`ILIKE` | ✓ |
`SIMILAR TO` | ✓ |
Matching using POSIX regular expressions | ✓ |
`EXISTS` | ✓ |
Scalar subqueries | ✓ |
Bitwise arithmetic | ✓ |
`COLLATE`| ✓ |
Column ordinal references | ✓ |
Type annotations | ✓ |

### Miscellaneous

Component | Supported | Details
-----------|-----------|---------
Column families | ✓ |
Computed columns (stored and virtual) | ✓ |
`ON UPDATE` expressions | ✓ |
Multi-region capabilities | ✓ |
System catalog schemas | ✓ |
Sequences | ✓ |
Identity columns | ✓ |
Views | ✓ |
Materialized views | ✓ |
Window functions | ✓ |
Common table expressions | ✓|
Stored procedures | ✓ |
Cursors | ✓ |
Triggers | ✓ |