Re: [SQL] Truncate table at a certain size.

2008-04-28 Thread Scott Marlowe
On Mon, Apr 28, 2008 at 7:24 PM, Gurjeet Singh <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 4:05 AM, Dana Huggard - Navarik > <[EMAIL PROTECTED]> wrote: > > > Hello, > > > > What would be the best method to truncate a table once it reaches a > > certain size. > > > > For instance, a table n

Re: [SQL] currval of sequence "my_seq" is not yet defined in this session

2008-04-28 Thread Scott Marlowe
On Mon, Apr 28, 2008 at 4:33 PM, Nacef LABIDI <[EMAIL PROTECTED]> wrote: > Hi all, > > I am writing some code to get the current value of a sequence using the > currval function to use this value in a following insert on another table. > But I am having this message "currval of sequence "my_seq" is

Re: [SQL] Truncate table at a certain size.

2008-04-28 Thread Gurjeet Singh
On Tue, Apr 29, 2008 at 4:05 AM, Dana Huggard - Navarik < [EMAIL PROTECTED]> wrote: > Hello, > > What would be the best method to truncate a table once it reaches a > certain size. > > For instance, a table named log. I can check the size of the log; > > db=# select pg_relation_size('log'); >

Re: [SQL] information_schema.referential_constraints permissions

2008-04-28 Thread Tom Lane
"Lodewijk Voege" <[EMAIL PROTECTED]> writes: > I have some code that gets foreign key information from > information_schema.referential_constraints. I was puzzled about why it wasn't > returning anything for a while, until I read the information_schema.sql file > and the documentation carefully: it

[SQL] Truncate table at a certain size.

2008-04-28 Thread Dana Huggard - Navarik
Hello, What would be the best method to truncate a table once it reaches a certain size. For instance, a table named log. I can check the size of the log; db=# select pg_relation_size('log'); pg_relation_size -- 8192 (1 row) What I would like t

[SQL] currval of sequence "my_seq" is not yet defined in this session

2008-04-28 Thread Nacef LABIDI
Hi all, I am writing some code to get the current value of a sequence using the currval function to use this value in a following insert on another table. But I am having this message "currval of sequence "my_seq" is not yet defined in this session". Can someone explain me what is the problem wit

[SQL] information_schema.referential_constraints permissions

2008-04-28 Thread Lodewijk Voege
hello, I have some code that gets foreign key information from information_schema.referential_constraints. I was puzzled about why it wasn't returning anything for a while, until I read the information_schema.sql file and the documentation carefully: it has a pg_has_role(c.relowner, 'USAGE') in it

Re: [SQL] psql: no schema info

2008-04-28 Thread chester c young
> > # \dt table1 -> does not show which schema info. was wrong on this - \dt shows schema for relations _not_ in the search path. my new good practice is to keep search_path = PUBLIC so all schema info is displayed always all the time invariably.

Re: [SQL] trim(both) problem?

2008-04-28 Thread Emi Lu
Thanks a lot for all help! I understand how trim work now. You could probably use instead: select replace('ROI Engineering Inc.', '', '') That would zap occurrences in the middle of the string, though. regexp_replace would be better since it'd allow anchoring the pattern, eg select regexp_re

Re: [SQL] psql: no schema info

2008-04-28 Thread Alvaro Herrera
chester c young wrote: > # create table new_schema.table1( > #col1 integer default nextval( 'seq1' ) > # ); > > using old_schema.seq1, not new_schema.seq1 Yes, that's correct -- assuming you had an old_schema.seq1 sequence too. > and imho to make matters more difficult to troubleshoot: > >

Re: [SQL] psql: no schema info

2008-04-28 Thread Richard Huxton
chester c young wrote: using 8.2 and 8.3 here's (psychological) problem as I see it: # set search_path=old_schema; # # create sequence new_schema.seq1; # # create table new_schema.table1( #col1 integer default nextval( 'seq1' ) # ); using old_schema.seq1, not new_schema.seq1 and imho to m