Help Center/ Database and Application Migration UGO/ FAQs/ Migration Project/ How Do I Solve ERROR: syntax error at or near "@"?
Updated on 2024-06-11 GMT+08:00

How Do I Solve ERROR: syntax error at or near "@"?

Symptom

In primary/standby GaussDB 3.2, 3.3, and 8.0 enterprise edition, after you enter set @a = 1;, the following error information is displayed:
Figure 1 Error message

Causes

The enable_set_variables parameter is not configured.

Solution

Method 1: Configuring the value of enable_set_variables and applying the new value in a specified database

  1. Connect to the database as the root user.
  2. Run the following command to configure the enable_set_variables parameter:

    alter database databasename set b_format_behavior_compat_options = 'enable_set_variables';

Method 2: Configuring the value of enable_set_variables and applying the new value in a specified instance

  1. Connect to the instance as the root user.
  2. Run the following command to switch to the instance user:

    su - omm

    In the preceding command, omm"indicates the instance user. Change it based on the site requirements.

  3. Run the following command to set the instance parameters:

    gs_guc reload -Z datanode -N all -I all -c "b_format_behavior_compat_options='enable_set_variables'";