Main Content

PostgreSQL Native Interface

Interact with a PostgreSQL database using the PostgreSQL native interface

Create a data source and connect to a PostgreSQL database. Explore data and import data from the database into MATLAB®. Export data from MATLAB into the database. Explore and import data using the Database Explorer app or the command line.

Objects

connectionPostgreSQL native interface database connection
SQLConnectionOptionsDefine PostgreSQL native interface database connection options

Functions

expand all

databaseConnectionOptionsCreate database connection options
rmoptionsRemove PostgreSQL native interface connection options
saveAsDataSourceSave PostgreSQL native interface data source
setoptionsSet PostgreSQL native interface connection options
resetReset PostgreSQL native interface connection options to defaults
testConnectionTest PostgreSQL native interface database connection
postgresqlCreate PostgreSQL native interface database connection
closeClose PostgreSQL native interface database connection
isopenDetermine if PostgreSQL native interface database connection is open
sqlfindFind information about all table types in PostgreSQL database
fetchImport results of SQL statement in PostgreSQL database into MATLAB
sqlreadImport data into MATLAB from PostgreSQL database table
sqlinnerjoinInner join between two PostgreSQL database tables
sqlouterjoinOuter join between two PostgreSQL database tables
executeSQLScriptExecute SQL script on PostgreSQL database
databaseImportOptionsDefine import options for database data
getoptionsRetrieve import options for database data
previewPreview eight rows from database using import options
setoptionsCustomize import options for database data
resetReset to default import options for database data
databaseDatastoreDatastore for data in database
hasdataDetermine if data in DatabaseDatastore is available to read
previewReturn subset of data from DatabaseDatastore
readRead data in DatabaseDatastore
readallRead all data in DatabaseDatastore
resetReset DatabaseDatastore to initial state
splitsqlquerySplit SQL query using paging
createConnectionForPoolInitialize parallel pool using database connection
sqlwriteInsert MATLAB data into PostgreSQL database table
executeExecute SQL statement using PostgreSQL native interface database connection
commitMake changes to PostgreSQL database permanent
rollbackUndo changes to PostgreSQL database

Topics

Configure PostgreSQL Native Interface

Configure PostgreSQL Native Interface Data Source

Configure a PostgreSQL native interface data source to a PostgreSQL database on Windows®.

Import Data into MATLAB

Import Data from PostgreSQL Database Table

Import data from one table in a PostgreSQL database by using various functions.

Customize Options for Importing Data from PostgreSQL Database into MATLAB

Customize import options for multiple variables when importing data from a database.

Import Large PostgreSQL Data Using DatabaseDatastore Object

Create a DatabaseDatastore object for accessing collections of data stored in a PostgreSQL database.

Export Data from MATLAB

Insert Data into Database Table Using PostgreSQL Native Interface

Perform calculations on data and insert the results into a PostgreSQL database using the sqlwrite function.

Execute Database Operations

Create Table and Add Column Using PostgreSQL Native Interface

Manage database structures using the CREATE and ALTER SQL statements in a PostgreSQL database.

Delete Data from Database Using PostgreSQL Native Interface

Delete data from a PostgreSQL database using an SQL DELETE statement.

Roll Back Data in Database Using PostgreSQL Native Interface

Roll back data after inserting data into a table in a PostgreSQL database.

Deploy Standalone Database Application

Deploy PostgreSQL Native Interface Database Application with MATLAB Compiler

Write a MATLAB script that connects to a PostgreSQL database and deploy the script as a standalone database application to other machines.