Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
Postgres unique date column

I wanted to create table with unique date column. Is it possible?

I have following table:

CREATE TABLE senders (
id              bigint  NOT NULL,
number          bigint  NOT NULL,
inserted_at     date    NOT NULL
); 

I want to be sure I will have unique values per date. For example I can insert (1, 1, '2017-01-01'),(1, 1, '2017-01-02') but I can't add then (1, 1, '2017-01-01') one more time. I tried using UNIQUE constraints creating table or unique indexes but always I have SQL unique exception.

CREATE UNIQUE INDEX senders_unique ON senders (id, number, inserted_at);

CREATE TABLE senders (
id              bigint  NOT NULL,
number          bigint  NOT NULL,
inserted_at     date    NOT NULL,
UNIQUE(id, number, inserted_at)
);

Is it possible. Thanks for all answers.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!