Thread: Limiting Row Count In a Table??
Hello, Is there a way in PG that allows limiting number of rows for a table. If not maybe there is another way to achieve this: I want my table to have only one row, if any other row is inserted or this one row is deleted it should give an error andwon't let it go. How can this be done the right way? Thanks... Cagil Seker ----------------- "Yes, I am a criminal. My crime is that of outsmarting you. Something that you'll never forgive me for!" - The Mentor'86(Hacker's Manifesto)
On Mon, Dec 02, 2002 at 17:04:06 +0200, Ça??l ?eker <cagils@biznet.com.tr> wrote: > Hello, > > Is there a way in PG that allows limiting number of rows for a table. > > If not maybe there is another way to achieve this: > I want my table to have only one row, if any other row is inserted or this one row is deleted it should give an error andwon't let it go. > > How can this be done the right way? A good start would be to only give out select and update access (and not delete or insert access). If that isn't good enough, then you will need to write triggers or rules to do it.
=?iso-8859-9?B?x2Hw/Wwg3mVrZXI=?= <cagils@biznet.com.tr> writes: > I want my table to have only one row, if any other row is inserted or this one row is deleted it should give an error andwon't let it go. Why don't you put in the one row, and then REVOKE insert and delete privileges from everyone (including yourself)? regards, tom lane