Home postgresql Non-database in PostgreSQL

Non-database in PostgreSQL




Tell me how to remove all records properly from all table tables, while not deleting the tables themselves?

Answer 1, Authority 100%

as an option:
Make a diagram dump, drop the entire scheme, restore from the dump.

pg_dump --schema-only database & gt; Bd.dump
PSQL -F DB.DUMP database

Answer 2, Authority 100%

select table_name from information_schema.tables
Truncate Table Table_Name.

C Postgra worked four years ago on Delphi, I hope without mistakes.
The request of the second line in the cycle naturally needs to be done according to the results of the first.

Maybe someone works with her now write the query by one line)

Answer 3, Authority 33%

delete from table_name;
(here can be a condition of type where consomer_id = 1 and god = 2010)

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions