Re: [SQL] Problems with PG_DUMP and restore

2001-07-11 Thread Richard Huxton
From: "Josh Berkus" <[EMAIL PROTECTED]> > Richard, > > Try having a look at the order the tables get inserted esp. with > > regard to > > any foreign keys etc. - I'm not sure pgdump is that clever about such > > things. > > Thanks. I did try that; however: > 1. Even trying re-loading the tables

Re: [SQL] SQL - histogram

2001-07-11 Thread Richard Huxton
From: "Txugo" <[EMAIL PROTECTED]> > I have a table where one record represent a person, including his height. > I'd like to know how many person have more than 150 cm, more than 160 cm > and so on. > How can I do that using SQL? > > Example: > people > 150 - 1000 >> 160 - 850 >>

Re: [SQL] Group by date_part

2001-07-11 Thread Richard Huxton
From: "Roberto Mello" <[EMAIL PROTECTED]> > On Tue, Jul 10, 2001 at 08:04:55PM +0100, Graham Vickrage wrote: > > > > The statement I have only selects the count if there is at least 1 order for > > a particular day, which make sense. > > > > I however need a count of 0 for days that don't have an

Re: [SQL] "Display of specified number of records."

2001-07-11 Thread Richard Huxton
From: "rajesh" <[EMAIL PROTECTED]> > Hi, > I have got following simple SQL. > Select TestID from test where testname = ' ' order by testdate. > > Suppose for argument sake there are 100 records and testID's are 1 > to 100. > Is it possible to modify this SQL so that it will display record

Re: [SQL] can we write to a flat file from Postgresql procedure

2001-07-11 Thread Jan Wieck
R Vijayanath wrote: > Hi, > > I found your name in the Postgresql web site. > > It would be great if you can tell me if I can write a > procedure that can write the output to the OS(Linux > OS) file. > > Can you assist me on this if there is a way to do it. > > We are using Postgresql 7.1 running

Re: [SQL] cumulative sum in aggregate query.

2001-07-11 Thread Tom Lane
David Stanaway <[EMAIL PROTECTED]> writes: > I have a query that gives me x/y data for a graph, and at the moment, > the y data is relative. > EG: > x | y > 1.2 | +1 > 1.9 | 0 > 3.4 | +4 > 5.2 | -2 > 6.7 | -1 > 9.3 | 0 > 11.3 | -1 > Now, I want to convert this result into a r

Re: [SQL] can we write to a flat file from Postgresql procedure

2001-07-11 Thread Peter Eisentraut
R Vijayanath writes: > It would be great if you can tell me if I can write a > procedure that can write the output to the OS(Linux > OS) file. You could try out PL/sh for that. http://www.postgresql.org/~petere/plsh.html YMMV -- Peter Eisentraut [EMAIL PROTECTED] http://funkturm.homeip.n

Re: [SQL] can we write to a flat file from Postgresql procedure

2001-07-11 Thread Alex Pilosov
On Wed, 11 Jul 2001, Peter Eisentraut wrote: > R Vijayanath writes: > > > It would be great if you can tell me if I can write a > > procedure that can write the output to the OS(Linux > > OS) file. > > You could try out PL/sh for that. > > http://www.postgresql.org/~petere/plsh.html Well, as l

[SQL] RE: can we write to a flat file from Postgresql procedure

2001-07-11 Thread Jeff Eckermann
I don't think there is any way to do this using any of the generally available tools. You could do a workaround using pl/pgsql, in the following way: * insert your data into a temp table * output the data to a file using COPY pl/pgsql allows INSERT statements, but does not allow CREA

[SQL] RE: can we write to a flat file from Postgresql procedure

2001-07-11 Thread Jeff Eckermann
I haven't seen anything on this list to say that pl/perlu is being worked on. Is it? > -Original Message- > From: Alex Pilosov [SMTP:[EMAIL PROTECTED]] > Sent: Wednesday, July 11, 2001 10:03 AM > To: Peter Eisentraut > Cc: R Vijayanath; [EMAIL PROTECTED] > Subject: Re: can we wr

[SQL] File system level backup

2001-07-11 Thread rocael
Hi! I have an installation of PG7.0.2 in a disk, for some reasons I didn't use that disk anymore but right now I want to use the dbs that I have there, the point is that I've mount that disk in other file system, so I copied the old /usr/local/pgsql/data to the new /usr/local/pgsql/data and tried

[SQL] RE: can we write to a flat file from Postgresql procedure

2001-07-11 Thread Alex Pilosov
Its done and committed to CVS, will be in 7.2 release. Also done is DBD::PgSPI, interface to access postgres from within your stored procedure. (www.formenos.org/PgSPI) -alex On Wed, 11 Jul 2001, Jeff Eckermann wrote: > I haven't seen anything on this list to say that pl/perlu is being worked

[SQL] Re: [BUGS] ERROR: deferredTriggerGetPreviousEvent: event for tuple(0,9) not found

2001-07-11 Thread Kristis Makris
On 11 Jul 2001 13:56:58 -0400, Tom Lane wrote: > > but if I want to clear the valuntil completely, how should I issue the > > ALTER USER statement? > > Offhand I don't believe ALTER USER can do that. Feel free to submit > a patch ;-). This seems to have a similar effect: ALTER USER test VALID

[SQL] Re: [BUGS] ERROR: deferredTriggerGetPreviousEvent: event for tuple(0,9) not found

2001-07-11 Thread Kristis Makris
> So that raises this from an unimplemented feature to a real bug, or at > least higher priority in my eyes. You can't do a CREATE/ALTER USER > followed by an UPDATE on pg_shadow in a single transaction: I'm glad I could be of some help. I don't know if the following means anything to you (or t

[SQL] Re: [BUGS] ERROR: deferredTriggerGetPreviousEvent: event for tuple (0,9) not found

2001-07-11 Thread Tom Lane
Kristis Makris <[EMAIL PROTECTED]> writes: > but if I want to clear the valuntil completely, how should I issue the > ALTER USER statement? Offhand I don't believe ALTER USER can do that. Feel free to submit a patch ;-). regards, tom lane ---(end

[SQL] trigger on DELETE

2001-07-11 Thread Phuong Ma
Hello everyone, I'm trying to define a trigger that copies the row to be deleted into another table (which is the inventory_audit table) before it does the delete from the original table (which is the inventory table). CREATE FUNCTION inv_audit_mod () RETURNS OPAQUE AS ' BEGIN NEW

[SQL] Re: [GENERAL] trigger on DELETE

2001-07-11 Thread Stephan Szabo
On Wed, 11 Jul 2001, Phuong Ma wrote: > I'm trying to define a trigger that copies the row to be deleted into > another table (which is the inventory_audit table) before it does the > delete from the original table (which is the inventory table). > > CREATE FUNCTION inv_audit_mod () RETURNS OPA

Re: [SQL] trigger on DELETE

2001-07-11 Thread Kristis Makris
> Ok, the function works only with a trigger that is defined as ON INSERT > OR UPDATE. If I try to define a trigger for ON DELETE and then delete a > row from the table, there is nothing in the 'NEW' variable to return. I > get an error message. If I define the function to return NULL, 0, or >