Cmdlets for PostgreSQL

Build 24.0.9060

Update-PostgreSQL Cmdlet

Parameters   Output Objects  

Updates PostgreSQL data.

Syntax

Update-PostgreSQL [parameters]

Remarks

The Update-PostgreSQL cmdlet allows you to use a syntax similar to SQL UPDATE statements to update PostgreSQL data.

$conn = Connect-PostgreSQL -User 'postgres' -Password 'admin' -Server '127.0.0.1' -Port '5432' -Database 'postgres'
Update-PostgreSQL -Connection $conn -Table "`"postgres`".`"schema01`".Orders" -Columns @("ShipCity") -Values @("Raleigh") -Id "10261"
The Where parameter can also be used to specify the primary key of the table:
Update-PostgreSQL -Connection $conn -Table "`"postgres`".`"schema01`".Orders" -Columns @("ShipCity") -Values @("Raleigh") -Where "Id = '10261'"
The primary key can also be passed to the cmdlet along the pipeline:
Select-PostgreSQL -Connection $conn -Table "postgres"."schema01".Orders -Where "ShipCountry = 'USA'" | Update-PostgreSQL -Columns @("ShipCountry") -Values @("USA 2")

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060