On 04/03/12 11:13 AM, leaf_yxj wrote:
Hi John, Thanks for your reply. Just to confirm : so truncate table
means the space will be reclaim for reuse ???
yes, all the tablespace is immediately returned to the file system when
the transaction with the TRUNCATE statement commits.
--
john r pi
If You mean parent and child tables as connected by relation (primery key -
foreign key) then child table will be truncated regardless the relation
type, if CASCADE exists.
This applies to PG 9.1.3 (I've got only this version).
Regards,
Bartek
2012/4/3 leaf_yxj
> Hi Bartek
> One more question,
Hi John, Thanks for your reply. Just to confirm : so truncate table means the
space will be reclaim for reuse ???
Thanks.
Grace
At 2012-04-04 02:01:59,"John R Pierce [via PostgreSQL]"
wrote:
On 04/03/12 10:49 AM, leaf_yxj wrote:
> --- I amn't sure what's differences between truncate and
On 04/03/12 10:49 AM, leaf_yxj wrote:
--- I amn't sure what's differences between truncate and delete in
postgresql. Could you do me a favour to tell me about this.
delete has to go through and flag each tuple for deletion so vacuum can
eventually go through and reclaim them for reuse. trunc
Hi Bartek
One more question, In oracle, when you create table using the default option,
the parent table can't be delete if there is any child table exist. Usually, I
won't use the cascade option. I will truncate or delete one by one. what is
postgresql default for these???
Thanks.
Regard
Bartek,
Thanks for your reminding. I don't know why CASCASE doesn't work in my
greenplum postgresql database (version 8.2.14). I can create the function
successfully without any errors. But when i call it, I alwasy got errors if I
include the CASCADE. If I delete the CASCADE, it will works. I d
One more thing:
TRUNCATE has option CASCASE:
http://www.postgresql.org/docs/9.1/static/sql-truncate.html
I don't remember since when, but 9.X has this option.
Another thing: Do You really need this function.
AFAIK since 8.4 postgres has TRUNCATE privilage on Table
http://www.postgresql.org/do
I think you need a space there:
>
>EXECUTE 'TRUNCATE TABLE ' || quote_ident(tablename) || ' CASCADE;';
>
indeed, that is my fault - sorry
> > EXCEPTION
> > WHEN undefined_table THEN
> > RAISE EXCEPTION 'Table "%" does not exists', tablename;
>
> It's really a pretty b
Tom,
Thanks. I found out the key issue it. It's because the truncate command
can't have the "cascade".
For the other people reference. The right funcitons are :
***
CREATE OR REPLACE FUNCTION truncate_t (IN tablename text)
RETURNS VOID
leaf_yxj writes:
> ***
> CREATE OR REPLACE FUNCTION truncate_t (IN tablename text)
> RETURNS VOID
> AS
> $$
> BEGIN
> EXECUTE 'TRUNCATE TABLE ' || quote_ident(tablename) || 'CASCADE;';
I think you need a space there:
EXECUTE '
Adrian, Thanks. Even I try use '' to quote the character. I still get the
error as follows :
rrp=> truncate table t1;
TRUNCATE TABLE
rrp=> select truncate_t('t1');
ERROR: table "t1" does not exist
Thanks.
Grace
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Please-he
On 04/03/2012 07:01 AM, leaf_yxj wrote:
***
CREATE OR REPLACE FUNCTION truncate_t (IN tablename text)
RETURNS VOID
AS
$$
BEGIN
EXECUTE 'TRUNCATE TABLE ' || quote_ident(tablename) || 'CASCADE;';
EXCEPTION
WHEN undefined_table
Alban, Thanks.
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Please-help-me-to-take-a-look-of-the-erros-in-my-functions-Thanks-tp5613507p5615244.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
--
Sent via pgsql-general mailing list (pgsql-g
Bartek, Thanks. The reason I use the cursor is that I want to check the table
is in the pg_tables or not,
If it exists, the function will execute successfully, if not, it will raise
the message that the table doesn't exist. For the schema part, I assume the
people has set the search_path to that
***
CREATE OR REPLACE FUNCTION truncate_t (IN tablename text)
RETURNS VOID
AS
$$
BEGIN
EXECUTE 'TRUNCATE TABLE ' || quote_ident(tablename) || 'CASCADE;';
EXCEPTION
WHEN undefined_table THEN
RAISE EXCEPTION 'Tab
On Wed, Jul 11, 2001 at 10:17:25AM +0100, Richard Huxton wrote:
> From: "Vijayan" <[EMAIL PROTECTED]>
> >
> > When I tried in psql, it gave this error. "No such function
> > 'to_char' with the specified attributes". But in postgre there is a
> Try "\df to_char" to see how/if to_char is defin
On Wed, Mar 14, 2001 at 12:17:57PM -0800,
keith <[EMAIL PROTECTED]> wrote:
> I am lost. I am a developer, new to Linux and to postgreSQL.
>
> I am trying to install postgreSQL on a linux machine. Every command I try to run
>gives me a command not found error. I cannot seem to do anything. I tr
17 matches
Mail list logo