Help Center/ GaussDB/ API Reference/ APIs (Recommended)/ SQL Patch/ Querying SQL Patch Information
Updated on 2025-10-20 GMT+08:00

Querying SQL Patch Information

Function

This API is used to query SQL patch information. Before calling this API:

Debugging

You can debug this API in API Explorer.

URI

GET /v3/{project_id}/instances/{instance_id}/sql-patch

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

To obtain the value, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 32 characters. Only letters and digits are allowed.

Default Value

N/A

instance_id

Yes

String

Definition

Instance ID, which uniquely identifies an instance.

Constraints

N/A

Range

The value can contain 36 characters. Only letters and digits are allowed.

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token.

You can obtain the token by calling the IAM API used to obtain a user token.

The value of X-Subject-Token in the response header is the token value.

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Language.

Constraints

N/A

Range

  • zh-cn
  • en-us

Default Value

en-us

Table 3 Request query parameters

Parameter

Mandatory

Type

Description

node_id

Yes

String

Definition

Node ID.

Constraints

N/A

Range

The value must contain 32 characters (including letters, digits, hyphens (-), or backslashes (\)), followed by no and then 14 or 20.

Default Value

N/A

sql_id

Yes

String

Definition

ID of the slow SQL statement. To obtain the value, see Querying Slow SQL Statements.

Constraints

N/A

Range

The value must consist of digits only and be 1 to 256 characters in length.

Default Value

N/A

database_name

No

String

Definition

Database name. This parameter is optional in slow SQL scenarios and mandatory in other scenarios.

Constraints

The name cannot be that of a template database. It must be an existing database name.

Template databases include template0, template1.

Range

The value can contain 0 to 63 characters, including only letters, digits, underscores (_), and dollar signs ($). The value cannot start with a digit.

Default Value

N/A

Response Parameters

Table 4 Response body parameters

Parameter

Type

Description

patch_name

String

Definition

Patch name.

Range

N/A

hint

String

Definition

Patch content (Hint text). Leave this field empty for ABORT SQL patches.

Range

N/A

patch_status

String

Definition

Patch status.

Range

  • enabled: indicates that the SQL patch is valid.
  • disabled: indicates that the SQL patch is invalid.

Example Request

Querying SQL patch information

GET https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/instances/d04686c6baae4f65a742771186f47b7ain14/sql-patch?node_id=d8e6ca5a624745bcb546a227aa3ae1cfin14&sql_id=28f61af50fc9452aa0ed5ea25c3cc3d3

Example Response

SQL patch information queried.

{
   "patch_name": "patch1",
   "hint": "indexscan(t1)",
   "patch_status": "enabled"
}

Status Codes

Error Codes

For details, see Error Codes.