pgUpdate

pgUpdate#

pgUpdate(connect, tablename, data, filter, varargin)#

Update PostgreSQL database table rows using row filters and MATLAB table data.

Updates existing database rows matching the provided filters with new data from a MATLAB table. Automatically adds missing columns as array types when needed and handles vector-valued data appropriately.

Parameters:
  • connect (database.postgre.connection) – Open PostgreSQL database connection

  • tablename (string) – Target database table name

  • data (table) – MATLAB table containing new data values

  • filter (matlab.io.RowFilter) – Row filters specifying which rows to update (one per table row)

  • isForceArray (logical, optional) – Force new columns to be created as array types (default: false)

Example:

conn = createWriter("myDatabase");
rf = rowfilter("SerialNumber");
rf = rf.SerialNumber == 1234;
pgUpdate(conn, "myTable", newData, rf);