Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Truncate table from terminal .

By
charlesraj
on 9/3/13, 3:51 AM 2,293 views

Is it possible to truncate the sale.order table from ubuntu terminal.

If yes please mention how it .

2

Gopakumar N G

--Gopakumar N G--
1198
| 5 3 7
Cochin, India
--Gopakumar N G--

Senior Software Engineer at BroadTech IT Solutions Pvt. Ltd.

Gopakumar N G
On 9/3/13, 4:09 AM

On the terminal

step 1. Locate postgresql, e.g. cd /opt/PostgreSQL/9.1/bin
step 2.  ./psql  --u database name.
step 3. /l  (database list)
step 4. /d (table list)

To truncate table:-

 truncate table table_name cascade (cascade if table contain relationship)

Thank Gopakumar. Is there any way to remove all the datas(sales, hr, products) in the database in a single step. But not affecting the default values. eg. In product's table product service

charlesraj
on 9/3/13, 4:25 AM

Error occured like this... root@jyothish-System-Product-Name:/usr/lib/postgresql/9.1/bin# ./psql --u ILAJ admin psql: FATAL: Peer authentication failed for user "ILAJ"

charlesraj
on 9/3/13, 4:35 AM

@47114 check the username and password you have entered, make sure that you are using correct username and password.

Gopakumar N G
on 9/3/13, 4:39 AM

i use the command TRUNCATE TABLE sale_order RESTART IDENTITY CASCADE; The table will be truncated but the id will not be reset . How can be make the id to start from the begining..

charlesraj
on 9/4/13, 2:46 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 9/3/13, 3:51 AM
Seen: 2293 times
Last updated: 3/16/15, 8:10 AM