CREATE USER USER_NAME WITH REPLICATION LOGIN PASSWORD 'USER_PASSWORD';
替换以下内容:
USER_NAME:您要创建的 Datastream 用户的名称。
USER_PASSWORD:您要创建的 Datastream 用户的登录密码。
向您创建的用户授予以下特权:
GRANT SELECT ON ALL TABLES IN SCHEMA SCHEMA_NAME TO USER_NAME;
GRANT USAGE ON SCHEMA SCHEMA_NAME TO USER_NAME;
ALTER DEFAULT PRIVILEGES IN SCHEMA SCHEMA_NAME
GRANT SELECT ON TABLES TO USER_NAME;
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-12。"],[[["\u003cp\u003eEnable logical replication in Cloud SQL by setting the \u003ccode\u003ecloudsql.logical_decoding\u003c/code\u003e flag to 'on' and restarting the instance to apply the changes.\u003c/p\u003e\n"],["\u003cp\u003eCreate a publication for specific tables or all tables, using the \u003ccode\u003eCREATE PUBLICATION\u003c/code\u003e command, to manage the data intended for replication.\u003c/p\u003e\n"],["\u003cp\u003eEstablish a replication slot with a unique name using the \u003ccode\u003ePG_CREATE_LOGICAL_REPLICATION_SLOT\u003c/code\u003e function for each stream replicating from the database.\u003c/p\u003e\n"],["\u003cp\u003eCreate a dedicated Datastream user with replication and login privileges, then grant it necessary \u003ccode\u003eSELECT\u003c/code\u003e and \u003ccode\u003eUSAGE\u003c/code\u003e privileges on the required schemas.\u003c/p\u003e\n"]]],[],null,[]]