You can connect to an ApsaraDB RDS for PostgreSQL instance for which Babelfish is enabled over the Tabular Data Stream (TDS) port. This topic describes the common operations and compatibility of SQL statements of the RDS instance after the connection.
Common operations
Category | Sample SQL statement | |
---|---|---|
System query | Query the version of a database. |
|
Query the information of a database. |
|
|
Database-related operations | Create a database. |
Note If you use the Single-DB migration mode, you can create only one database. If you have created a database,
you cannot create another database.
|
Query a database. |
|
|
Switch to a different database. |
|
|
Delete a database. |
|
|
Schema-related operations | Create a schema. |
|
View a schema. |
|
|
Use a schema to create a table. |
|
|
Delete a schema. |
Note If a table is created by using a schema, you must delete the table before you delete
the schema.
|
|
Table-related operations | Create a table. |
|
Query a table. |
|
|
Create a field. |
|
|
Modify a field in a table. |
|
|
Delete a field from a table. |
|
|
Create an index. |
|
|
Delete an index. |
|
|
Database-related operations | INSERT |
|
SELECT |
|
|
UPDATE |
|
|
DELETE |
|
|
Operations related to a stored procedure | Create a stored procedure. |
|
View a stored procedure. |
|
|
Execute a stored procedure. |
|
|
Delete a stored procedure. |
|
Compatibility
Note This section provides only common incompatibility scenarios. For more information,
see Babelfish for PostgreSQL official documentation.
The following SQL statements are not supported for an RDS instance for which Babelfish
is enabled:
- View the schema of a table. Example:
EXEC sp_help 'dbo.tb_test'
- When you modify a field in a table, set the default value to null. Example:
ALTER TABLE dbo.tb_test ALTER column col_added varchar(50) null; GO
- Recreate an index. We recommend that you delete an index and then create an index.
Example:
ALTER INDEX ix_tb_test_name ON tb_test REBUILD; GO
- Modify a stored procedure. We recommend that you delete a stored procedure and then
create a stored procedure. Example:
USE testdb GO ALTER PROC dbo.UP_getDemoData( @id int ) AS BEGIN SET NOCOUNT ON SELECT * FROM dbo.tb_test WHERE id >= @id END; GO
- Query an execution plan. Example:
SET showplan_xml ON SELECT * from tb_test;