mirror of
https://github.com/n8n-io/n8n-docs.git
synced 2025-11-20 17:48:34 +00:00
2.4 KiB
2.4 KiB
| permalink |
|---|
| /nodes/n8n-nodes-base.postgres |
Postgres
PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.
::: tip 🔑 Credentials You can find authentication information for this node here. :::
Basic Operations
- Execute an SQL query
- Insert rows in database
- Update rows in database
Example Usage
This workflow allows you to run an SQL query on a Postgres instance. You can also find the workflow on n8n.io. This example usage workflow would use the following nodes.
The final workflow should look like the following image.
1. Start node
The start node exists by default when you create a new workflow.
2. Postgres node (Execute Query)
- First of all, you'll have to enter credentials for the Postgres node. You can find out how to do that here.
- Select 'Execute Query' from the Operation dropdown list.
- Enter the following SQL query in the Query field:
CREATE TABLE test (id INT, name VARCHAR(255), PRIMARY KEY (id));. - Click on the Node tab and toggle Always Output Data to true.
- Click on Execute Node to run the node.
3. Set node
- Click on the Add Value button and select 'Number' from the dropdown list.
- Enter
idin the Name field. - Click on the Add Value button and select 'String' from the dropdown list.
- Enter
namein the Name field. - Enter the value for the name in the Value field.
- Click on Execute Node to run the node.
4. Postgres1 node (Insert)
- Select the credentials that you entered in the previous Postgres node.
- Enter
testin the Table field. - Enter
id, namein the Columns field. - Click on Execute Node to run the node.



