How to make a non-removable row in a table? - Mailing list pgsql-general

From Капралов Александр
Subject How to make a non-removable row in a table?
Date
Msg-id CAJqqVEXwJUAb7nG7GHg+K93GvaRpM8ubgXkn5nOBYz5FOUSP6g@mail.gmail.com
Whole thread Raw
Responses Re: How to make a non-removable row in a table?  (Thomas Markus <t.markus@proventis.net>)
List pgsql-general
Hi all.

How to make a non-removable row in a table?

In my case, I should not accidentally delete a row with id = 0.

CREATE TABLE profile (

    id integer NOT NULL,

    name character varying(265) NOT NULL

);

CREATE SEQUENCE profile_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;

ALTER TABLE profile ALTER COLUMN id SET DEFAULT
nextval('profile_id_seq'::regclass);

ALTER TABLE ONLY profile ADD CONSTRAINT profile_pkey PRIMARY KEY (id);

INSERT INTO profile VALUES (0,'non-removable Profile');

pgsql-general by date:

Previous
From: Yan Chunlu
Date:
Subject: Re: pg_dump and pg_restore make data dir doubled size?
Next
From: Yan Chunlu
Date:
Subject: ignore duplicate key while using COPY?