Re: [GENERAL] Simpler dump?

2007-12-09 Thread Tom Lane
Ted Byers <[EMAIL PROTECTED]> writes: > Is there a way to tell pg_dump to just dump the SQL > statements required to create the tables, sequences, > indeces, keys, &c.? pg_dump -s ? > I DON'T need to restore or > recreate things like users, or most other kinds of DB > objects. Just routine DDL s

Re: [GENERAL] Simpler dump?

2007-12-09 Thread Uwe C. Schroeder
pg_dump -x -O -s [databasename] > outfile.sql HTH Uwe On Sunday 09 December 2007, Ted Byers wrote: > Is there a way to tell pg_dump to just dump the SQL > statements required to create the tables, sequences, > indeces, keys, &c.? I DON'T need to restore or > recreate things like users,

[GENERAL] Simpler dump?

2007-12-09 Thread Ted Byers
Is there a way to tell pg_dump to just dump the SQL statements required to create the tables, sequences, indeces, keys, &c.? I DON'T need to restore or recreate things like users, or most other kinds of DB objects. Just routine DDL statements. Looking through a dump file for a small database, it

[GENERAL] Log statement length limit

2007-12-09 Thread Brian Herlihy
Hi, How do I get postgres to log only the first n characters of a command? Actually, ideal would be if it would log the structure of the command but cut short any long data values. Such as UPDATE table SET value = 'something really long which is cut ...' WHERE pkey = 'foo' The idea being tha

Re: [GENERAL] sequence

2007-12-09 Thread Michael Schmidt
Another option is to set the default value of the field to the nextval, such as for mytable primary key field nextval(('public.users_user_id_seq'::text)::regclass). Then, when you write your SQL INSERT INTO mytable VALUES(default). I do it this way and find it a little cleaner. If you want t

[GENERAL] Problems with acessing xml functions on other database

2007-12-09 Thread x asasaxax
Hi everyone, I had the folowing problem: when i try to execute a xml_string function on a database 'a' it works, but when i try this in database 'b' it doesen´t works. Did anyone knows what its going on? Is that some kind of permission? Thanks a lot

Re: [GENERAL] insert into...

2007-12-09 Thread Tom Lane
> "Alain Roger" <[EMAIL PROTECTED]> writes: > i would like to understand why the following INSERT INTO statement works : > INSERT INTO mytable >SELECT nextval('my_sequence'), >'myname', >'myfirstname' > ; This is a perfectly standard INSERT ... SELECT query. > whereas usually we shou

Re: [GENERAL] insert into...

2007-12-09 Thread Dave Cramer
Values is optional. We support insert into select Dave On 9-Dec-07, at 11:05 AM, Alain Roger wrote: Hi, i would like to understand why the following INSERT INTO statement works : INSERT INTO mytable SELECT nextval('my_sequence'), 'myname', 'myfirstname' ; whereas usually we shou

Re: [GENERAL] insert into...

2007-12-09 Thread Michael Glaesemann
On Dec 9, 2007, at 11:05 , Alain Roger wrote: Hi, i would like to understand why the following INSERT INTO statement works : INSERT INTO mytable SELECT nextval('my_sequence'), 'myname', 'myfirstname' ; whereas usually we should do : INSERT INTO mytable VALUES ( SELECT nextval

Re: [GENERAL] sequence

2007-12-09 Thread Scott Marlowe
On Dec 9, 2007 9:56 AM, Alain Roger <[EMAIL PROTECTED]> wrote: > Hi Tom, > > but when i let pgsql setup everything (i mean when i create table -> pgsql > creates sequence) > ), i have called = no, before using any select nextval()... > and in this case, it works great. > > but once called = yes, se

[GENERAL] insert into...

2007-12-09 Thread Alain Roger
Hi, i would like to understand why the following INSERT INTO statement works : INSERT INTO mytable SELECT nextval('my_sequence'), 'myname', 'myfirstname' ; whereas usually we should do : INSERT INTO mytable VALUES ( SELECT nextval('my_sequence'), 'myname', 'myfirstname' ); t

Re: [GENERAL] sequence

2007-12-09 Thread Alain Roger
Hi Tom, but when i let pgsql setup everything (i mean when i create table -> pgsql creates sequence) ), i have called = no, before using any select nextval()... and in this case, it works great. but once called = yes, select nextval(sequence_name); always gives me current value +1 :-( A. On Dec

Re: [GENERAL] sequence

2007-12-09 Thread Tom Lane
"Alain Roger" <[EMAIL PROTECTED]> writes: > to perform an autoincrement in my SQL queries...specially while i use insert > into i do the following thing : > INSERT INTO mytable VALUES > ( > select nextval('users_user_id_seq'), > ... > ); > however this get the currentvalue + 1, or during creati

[GENERAL] sequence

2007-12-09 Thread Alain Roger
Hi, I'm still trying to understand how the sequences work under PostgreSQL. for example i have a sequence called : users_user_id_seq with : current value = 1 min value = 1 max value = 9223372036854775807 start = 1 a typical "serial" field. to perform an autoincrement in my SQL queries...speciall