Unix Technical Forum

truncate error

This is a discussion on truncate error within the pgsql Admins forums, part of the PostgreSQL category; --> PostgreSQL 8.1 beta 2 raise error on truncating tables with foreign keys, try this to see !!! __________________________________________________ _______________ ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 06:19 AM
=?iso-8859-1?B?U2lkYXIgTPNwZXogQ3J1eg==?=
 
Posts: n/a
Default truncate error

PostgreSQL 8.1 beta 2 raise error on truncating tables with foreign keys,
try this to see !!!

__________________________________________________ _______________
Consigue aquí las mejores y mas recientes ofertas de trabajo en América
Latina y USA: http://latam.msn.com/empleos/


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 06:19 AM
Alvaro Herrera
 
Posts: n/a
Default Re: truncate error

On Tue, Oct 04, 2005 at 08:40:31AM -0600, Sidar López Cruz wrote:
> PostgreSQL 8.1 beta 2 raise error on truncating tables with foreign keys,
> try this to see !!!


Hum, what were you trying to show us? Truncating tables with foreign
keys is supposed to work as long as you truncate the referenced table at
the same time.

--
Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 17.7", W 73º 14' 26.8"
"La felicidad no es mañana. La felicidad es ahora"

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 06:20 AM
=?iso-8859-1?B?U2lkYXIgTPNwZXogQ3J1eg==?=
 
Posts: n/a
Default FW: truncate error

Yo primero hice truncate a la tabla derivada y luego a la tabla maestra y
PostgreSQL no me lo permitia, entonces hice DELETE sobre la tabla maestro y
si pudo borrar los registros, aun no se porque pasa eso.


>From: Alvaro Herrera <alvherre@alvh.no-ip.org>
>To: Sidar López Cruz <sidarlopez@hotmail.com>
>CC: pgsql-admin@postgresql.org
>Subject: Re: [ADMIN] truncate error
>Date: Tue, 4 Oct 2005 11:21:42 -0400
>
>On Tue, Oct 04, 2005 at 08:40:31AM -0600, Sidar López Cruz wrote:
> > PostgreSQL 8.1 beta 2 raise error on truncating tables with foreign

>keys,
> > try this to see !!!

>
>Hum, what were you trying to show us? Truncating tables with foreign
>keys is supposed to work as long as you truncate the referenced table at
>the same time.
>
>--
>Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 17.7", W 73º 14'
>26.8"
>"La felicidad no es mañana. La felicidad es ahora"
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly


__________________________________________________ _______________
MSN Amor: busca tu ½ naranja http://latam.msn.com/amor/


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-10-2008, 06:20 AM
Alvaro Herrera
 
Posts: n/a
Default Re: FW: truncate error

On Tue, Oct 04, 2005 at 10:01:42AM -0600, Sidar López Cruz wrote:
> Yo primero hice truncate a la tabla derivada y luego a la tabla maestra y
> PostgreSQL no me lo permitia, entonces hice DELETE sobre la tabla maestro y
> si pudo borrar los registros, aun no se porque pasa eso.


Hola, el idioma de esta lista es el inglés y por lo tanto nos debemos
restringir a usar ese idioma. Para discusiones en castellano te sugiero
la lista pgsql-es-ayuda.

Con respecto a TRUNCATE, en 8.1 se puede hacer simultáneamente a ambas
tablas:

TRUNCATE tabla_derivada, tabla_maestra;

y debería funcionar (si no funciona, es un bug, por favor reportalo).
En versiones anteriores no está permitido usar TRUNCATE en tablas que
tienen llaves foráneas, ni se permite hacer TRUNCATE en más de una
tabla simultáneamente.

--
Alvaro Herrera http://www.amazon.com/gp/registry/CTMLCN8V17R4
Essentially, you're proposing Kevlar shoes as a solution for the problem
that you want to walk around carrying a loaded gun aimed at your foot.
(Tom Lane)

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:23 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com