[{"data":1,"prerenderedAt":335},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fintegration\u002Fpostgresql-writer\u002F":3},{"id":4,"title":5,"body":6,"description":326,"extension":327,"meta":328,"navigation":329,"path":330,"redirect":331,"seo":332,"stem":333,"__hash__":334},"docs\u002Fdocs\u002Fintegration\u002Fpostgresql-writer\u002Findex.md","PostgreSQL Target Configuration",{"type":7,"value":8,"toc":319},"minimark",[9,13,17,20,25,28,98,101,130,141,154,158,161,220,238,242,249,257,261,285,289,315],[10,11,5],"h1",{"id":12},"postgresql-target-configuration",[14,15,16],"p",{},"Use this page when PostgreSQL is the target for a DBConvert Streams workflow.",[14,18,19],{},"PostgreSQL targets receive data from both Load and CDC streams. The source can be MySQL, PostgreSQL, local files, or S3-compatible storage.",[21,22,24],"h2",{"id":23},"target-privileges","Target privileges",[14,26,27],{},"The target user needs write access to the target database and schema. The exact privileges depend on the stream configuration:",[29,30,31,44],"table",{},[32,33,34],"thead",{},[35,36,37,41],"tr",{},[38,39,40],"th",{},"Privilege",[38,42,43],{},"When needed",[45,46,47,60,71,81],"tbody",{},[35,48,49,57],{},[50,51,52,56],"td",{},[53,54,55],"code",{},"INSERT"," on tables",[50,58,59],{},"Always — all streams write rows",[35,61,62,68],{},[50,63,64,67],{},[53,65,66],{},"CREATE"," on schema",[50,69,70],{},"When structure options allow table\u002Findex creation",[35,72,73,78],{},[50,74,75,67],{},[53,76,77],{},"USAGE",[50,79,80],{},"Always — required to access schema objects",[35,82,83,88],{},[50,84,85,56],{},[53,86,87],{},"TRUNCATE",[50,89,90,91,94,95],{},"When ",[53,92,93],{},"writeMode"," is ",[53,96,97],{},"truncate_and_load",[14,99,100],{},"Example grants for a target user that can create and write:",[102,103,108],"pre",{"className":104,"code":105,"language":106,"meta":107,"style":107},"language-sql shiki shiki-themes github-light github-dark","GRANT USAGE, CREATE ON SCHEMA public TO target_user;\nGRANT INSERT, UPDATE, TRUNCATE ON ALL TABLES IN SCHEMA public TO target_user;\nALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT INSERT, UPDATE, TRUNCATE ON TABLES TO target_user;\n","sql","",[53,109,110,118,124],{"__ignoreMap":107},[111,112,115],"span",{"class":113,"line":114},"line",1,[111,116,117],{},"GRANT USAGE, CREATE ON SCHEMA public TO target_user;\n",[111,119,121],{"class":113,"line":120},2,[111,122,123],{},"GRANT INSERT, UPDATE, TRUNCATE ON ALL TABLES IN SCHEMA public TO target_user;\n",[111,125,127],{"class":113,"line":126},3,[111,128,129],{},"ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT INSERT, UPDATE, TRUNCATE ON TABLES TO target_user;\n",[14,131,132,133,136,137,140],{},"For ",[53,134,135],{},"drop_and_recreate"," schema policy, the user also needs ownership of the tables or superuser access, since PostgreSQL uses ",[53,138,139],{},"DROP TABLE ... CASCADE",".",[14,142,143,144,149,150,140],{},"For connection and network setup, see ",[145,146,148],"a",{"href":147},"\u002Fdocs\u002Fconnections\u002Fpostgresql-server","PostgreSQL Server Configuration",". To verify visible schemas and tables, open the connection in ",[145,151,153],{"href":152},"\u002Fdocs\u002Fdatabase-explorer\u002F","Data Explorer",[21,155,157],{"id":156},"target-behavior","Target behavior",[14,159,160],{},"Two settings control what the stream does with existing target tables and data:",[29,162,163,179],{},[32,164,165],{},[35,166,167,170,173,176],{},[38,168,169],{},"Setting",[38,171,172],{},"What it controls",[38,174,175],{},"Default (Load)",[38,177,178],{},"Default (CDC)",[45,180,181,201],{},[35,182,183,188,191,196],{},[50,184,185],{},[53,186,187],{},"schemaPolicy",[50,189,190],{},"What to do if target tables already exist",[50,192,193],{},[53,194,195],{},"fail_if_exists",[50,197,198],{},[53,199,200],{},"validate_existing",[35,202,203,207,210,215],{},[50,204,205],{},[53,206,93],{},[50,208,209],{},"What to do if target tables contain rows",[50,211,212],{},[53,213,214],{},"fail_if_not_empty",[50,216,217],{},[53,218,219],{},"upsert",[14,221,222,223,225,226,229,230,232,233,237],{},"CDC mode supports ",[53,224,219],{}," (default, recommended) and ",[53,227,228],{},"append",". Use ",[53,231,228],{}," for insert-only workloads where you want maximum write throughput. See ",[145,234,236],{"href":235},"\u002Fdocs\u002Fstreams\u002Ftarget-data-policies","Target Schema and Data Policies"," for all values and decision guidance.",[21,239,241],{"id":240},"structure-creation","Structure creation",[14,243,244,245,140],{},"By default, the stream creates missing tables, indexes, foreign keys, and check constraints on the target. Disable any of these with ",[145,246,248],{"href":247},"\u002Fdocs\u002Fstreams\u002Fdatabase-structure-options","structure options",[14,250,251,252,256],{},"When the source is MySQL, data types are converted automatically. See ",[145,253,255],{"href":254},"\u002Fdocs\u002Fintegration\u002Ftranslate-ddl","Table Structure Conversion"," for the full mapping.",[21,258,260],{"id":259},"validation-checklist","Validation checklist",[262,263,264,276,279,282],"ol",{},[265,266,267,268,270,271,275],"li",{},"Test the target connection from the ",[145,269,153],{"href":152}," sidebar (right-click → ",[272,273,274],"strong",{},"Test connection",") or from the connection editor.",[265,277,278],{},"Open the target database in Data Explorer and confirm the expected database and schemas are reachable.",[265,280,281],{},"Verify the target user has the required privileges for your chosen schema policy and write mode.",[265,283,284],{},"Run a small validation stream (one or two tables) before scaling up.",[21,286,288],{"id":287},"related-docs","Related docs",[290,291,292,296,300,305,309],"ul",{},[265,293,294],{},[145,295,148],{"href":147},[265,297,298],{},[145,299,236],{"href":235},[265,301,302],{},[145,303,304],{"href":247},"Database Structure Options",[265,306,307],{},[145,308,255],{"href":254},[265,310,311],{},[145,312,314],{"href":313},"\u002Fdocs\u002Fstreams\u002Fstream-configuration-guide","Stream Configuration Guide",[316,317,318],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":107,"searchDepth":120,"depth":120,"links":320},[321,322,323,324,325],{"id":23,"depth":120,"text":24},{"id":156,"depth":120,"text":157},{"id":240,"depth":120,"text":241},{"id":259,"depth":120,"text":260},{"id":287,"depth":120,"text":288},"Configure PostgreSQL as a target in DBConvert Streams Load and CDC workflows.","md",{},false,"\u002Fdocs\u002Fintegration\u002Fpostgresql-writer",null,{"title":5,"description":326},"docs\u002Fintegration\u002Fpostgresql-writer\u002Findex","trPVPH-ak67AgvLt_D_jNZlpy2eEpIkR5PLtDvfmzsI",1783896285869]