jamesplease / jamesplease/api-pls

Ignore foreign key columns for `updated_at`

Open
#205 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
10
Forks
1
PR merge metrics
No merged PRs in 30d

Description

This could alleviate unexpected `updated_at` values by making the host and the guest behave the same.

---

Atm I compare the new row against the old using `NEW` and `OLD`. This would require looping and checking just the columns I want, which would likely be slower. But maybe I can do an analogy to `_.pick` to reduce the columns of what is compared without it being much slower?

Docs here: https://www.postgresql.org/docs/9.2/static/plpgsql-trigger.html

---

Related: http://dba.stackexchange.com/questions/1957/sql-select-all-columns-except-some

---

Based on the above Q&A, it may be best to just write out the values to check at the time that the thing is created. For instance,

`NEW.a, NEW.b, NEW.c`,

leaving out `NEW.foreign_key_column`. All of these values would be known at the time that I'm configuring the trigger. Migrating the table would require deleting and re-adding a new trigger. And performance may be a consideration?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue links PostgreSQL's PL/pgSQL trigger documentation; start there and trace the trigger configuration entry point in the repository. Define which foreign-key columns must be excluded from NEW/OLD comparison and verify that host and guest updated_at behavior matches. No source file or test is named, so locating the implementation and test coverage is part of the work.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.