n8n/packages/nodes-base
Elias Meire bed04ec122
fix(Postgres Node): Stop marking autogenerated columns as required (#8230)
## Summary

Postgres columns can be
- [generated as
identity](https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-identity-column/)
- [generated by a custom
expression](https://www.postgresql.org/docs/current/ddl-generated-columns.html)

In these 2 cases, the column is not required when inserting a new row.
This PR makes sure these types of column are not marked required in n8n.

### How to test

1. Create a Postgres table with all types of generated columns:
for version >= 10
  ```sql
  CREATE TABLE "public"."test_table" (
      "id" int8 NOT NULL DEFAULT nextval('test_table_id_seq'::regclass),
      "identity_id" bigint GENERATED ALWAYS AS IDENTITY,
      "id_plus" numeric GENERATED ALWAYS AS (id + 5) STORED,
      "title" varchar NOT NULL,
      "created_at" timestamp DEFAULT now(),
      PRIMARY KEY ("id")
  )
  ```
  Before 10 you have to use serial or bigserial types:
  ```sql
  CREATE TABLE distributors (
     did    serial not null primary key,
     name   varchar(40) NOT NULL CHECK (name <> '')
);
  ```
2. Add a postgres node to canvas and try to insert data without the
generated columns
3. Should successfully insert

More info in Linear/Github issue ⬇️ 

## Related tickets and issues
- fixes #7084
-
https://linear.app/n8n/issue/NODE-816/rmc-not-all-id-fields-should-be-required
-
https://linear.app/n8n/issue/NODE-681/postgres-cant-map-automatically-if-database-requires-a-field

## Review / Merge checklist
- [ ] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [ ] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
   > A feature is not complete without tests.

---------

Co-authored-by: Michael Kret <michael.k@radency.com>
2024-01-05 12:37:33 +01:00
..
credentials feat(Wordpress Node): Add option to ignore error when using self signed certificates (#8199) 2024-01-03 10:52:01 +00:00
nodes fix(Postgres Node): Stop marking autogenerated columns as required (#8230) 2024-01-05 12:37:33 +01:00
scripts ci: Validate load options methods in nodes-base (no-changelog) (#5862) 2023-04-12 15:46:11 +02:00
test refactor(Peekalink Node): Stricter typing for Peekalink api call + Tests (no-changelog) (#8125) 2023-12-21 18:22:32 +01:00
utils feat(core): Improvements/overhaul for nodes working with binary data (#7651) 2024-01-03 13:08:16 +02:00
.eslintrc.js refactor(Peekalink Node): Stricter typing for Peekalink api call + Tests (no-changelog) (#8125) 2023-12-21 18:22:32 +01:00
gulpfile.js refactor: Validate formatting in nodes-base (no-changelog) (#4685) 2022-11-22 12:44:35 +01:00
index.js fix(core): Improve community nodes loading (#5608) 2023-03-24 17:04:26 +01:00
jest.config.js refactor(core): Abstract away InstanceSettings and encryptionKey into injectable services (no-changelog) (#7471) 2023-10-23 13:39:35 +02:00
LICENSE.md docs: scope Sustainable Use License to contents of the main branch (#4450) 2022-10-26 16:50:33 +02:00
LICENSE_EE.md docs(license): Introduce n8n Enterprise License (#3945) 2022-08-29 22:08:42 +02:00
package.json 🚀 Release 1.23.0 (#8205) 2024-01-03 13:41:28 +01:00
README.md docs: Replace http://faircode.io to https://faircode.io in .md files (#7908) 2023-12-12 15:23:22 +00:00
tsconfig.build.json ci: Fix typescript incremental builds (no-changelog) (#7275) 2023-09-29 13:26:06 +02:00
tsconfig.json ci: Fix typescript incremental builds (no-changelog) (#7275) 2023-09-29 13:26:06 +02:00

n8n.io - Workflow Automation

n8n-nodes-base

The nodes which are included by default in n8n

npm install n8n-nodes-base -g

License

n8n is fair-code distributed under the Sustainable Use License.

Proprietary licenses are available for enterprise customers. Get in touch

Additional information about the license can be found in the docs.