Re: [SQL] Break a report in Run Time

2004-03-11 Thread Jonathan Gardner
> If you are in psql, you can cancel any query with CTRL-C. Otherwise, > > you can kill the process running the query using the "kill" command. If > > that doesn't work you can kill (but not -9!) the backend process > > handling your query. > > > > &

Re: [SQL] Break a report in Run Time

2004-03-10 Thread Jonathan Gardner
On Wednesday 10 March 2004 10:23 am, Jander wrote: >I have a application with a lof of reports. I need to > break a report in Run Time. How can I do this? > Could you clarify what you mean by "break a report in run time"? -- Jonathan Gardn

Re: [SQL] Changing primary keys

2004-03-10 Thread Jonathan Gardner
aranteed that the data won't violate the boss's idea of what the pk should be. -- Jonathan Gardner [EMAIL PROTECTED] ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [HACKERS] [SQL] Materialized View Summary

2004-02-29 Thread Jonathan Gardner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday 24 February 2004 01:48 pm, Robert Treat wrote: > On Tue, 2004-02-24 at 12:11, Richard Huxton wrote: > > On Tuesday 24 February 2004 16:11, Jonathan M. Gardner wrote: > > > I've written a summary of my findings on implementing and using > > >

Re: [SQL] INSERT INTO ... SELECT

2003-08-14 Thread Jonathan Gardner
t statement? If not, what is an > alternative to insert a single row at a time? > I'm not too sure on what you want, but I'll guess. INSERT INTO test_table (int_id, cust_id, cust_name) SELECT 1, id, name FROM customer; Does this do what you want? - -- Jonathan Gardner <[

Re: [SQL] Order of triggers - totally lost

2003-08-14 Thread Jonathan Gardner
the trigger order), but the > trigger order is still strange for me: > I'd need some solid code to solve this. Can you send the create statements and the insert statement that started it all? I get the feeling that you may have more triggers than you really need. - -- Jonathan Gardner &

Re: [SQL] Order of triggers - totally lost

2003-08-14 Thread Jonathan Gardner
e. If a trigger triggers another trigger, they aren't dependant on the order thereof, or even the existance of the other trigger. You may also want to examine PostgreSQL's RULE system (CREATE RULE). I think some of your triggers may be interchangeable with rules. - -- Jonathan Gardner

Re: [SQL] How to speeed up the query performance

2003-08-14 Thread Jonathan Gardner
he "How to optimize this query ?" thread. If you want more details, check the pgsql-performance archives. - -- Jonathan Gardner <[EMAIL PROTECTED]> Live Free, Use Linux! -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/OlBBWgwF3QvpWNwR

Re: [SQL] How to check: is some key referenced from sometable

2003-08-14 Thread Jonathan Gardner
pg_trigger table. The way PostgreSQL manages the foreign key references is through triggers. You may be able to identify which triggers are which, and from there, determine which tables are referencing which tables. - -- Jonathan Gardner <[EMAIL PROTECTED]

Re: [SQL] optimisation of a code

2003-08-14 Thread Jonathan Gardner
his to the postgresql-performance list. They love taking things apart and getting it running faster. They'll want: - - The tables - - The indexes - - The queries - - The results of EXPLAIN and EXPLAIN ANALYZE on the queries - - What you have already tried and what seems to work and what doesn&#

Re: [SQL] RI_ConstraintTrigger_11264756

2003-08-14 Thread Jonathan Gardner
ers and altered the table to have the foreign keys to remedy this. - -- Jonathan Gardner <[EMAIL PROTECTED]> Live Free, Use Linux! -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/M9BAWgwF3QvpWNwRAmrKAKDrkW914nrOqiUm4D9JCYsmD982awCfYh3T pvdmcoJfo0f/bIFubyMUfbs= =yzi0 -

Re: [SQL] converting interval to timestamp

2003-08-14 Thread Jonathan Gardner
? > Post this question it the interfaces list. I am sure they would be more helpful. - -- Jonathan Gardner <[EMAIL PROTECTED]> Live Free, Use Linux! -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/M84pWgwF3QvpWNwRAnOiAKC9t3rZNve8KyOgXyxMG/p75OxkTwCeP+Tv ZYuv

Re: [SQL] duplicate dates

2003-08-09 Thread Jonathan Gardner
to group it by. Note that date_part can give you interesting groupings (all the Decembers, all the 1st of the months, all the Fridays, etc...) If you want to run through it several times, you can have a sub-select in the from clause. You could also save the results in a temp table. - -- J

Re: [SQL] Analyze makes queries slow...

2003-08-08 Thread Jonathan Gardner
he different explain plans that were generated. If you know what it is, you may also want to attach the relevant statistics from the pg_stats table. They will be most helpful. - -- Jonathan Gardner <[EMAIL PROTECTED]> Live Free, Use Linux! -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (G

Re: [SQL] parse error for function def

2003-07-17 Thread Jonathan Gardner
- column2 (the table/column that is the primary key being reference) EXECUTE ''SELECT $3 FROM $2 WHERE $3=NEW.$1''; IF FOUND THEN RETURN NEW RAISE ERROR ''Foreign key violation.''; RETURN; END' LANGUAGE 'plpgsql'; - --

Re: [SQL] problem with temporary table.

2003-07-16 Thread Jonathan Gardner
ation 'temp_table' > already exists. > So drop the table when you are done with it. You may also want to investigate returning a table of data, rather than a cursor or a single row. I am not too sure on how this would work exactly because I have never done it. Someone else may b

Re: [SQL] Database design - AGAIN

2003-06-24 Thread Jonathan Gardner
ert your data over to the new design. - -- Jonathan Gardner <[EMAIL PROTECTED]> (was [EMAIL PROTECTED]) Live Free, Use Linux! -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE++HBcWgwF3QvpWNwRAgjPAJ48syjGQahHvU4zi38WVheFbVFC5ACfQw5S 0qO67ZB2ToO

Re: [SQL] [ADMIN] Latest transcation

2003-06-20 Thread Jonathan Gardner
will pass back all the data you need. You get a free transaction block inside the stored procedure as well. - -- Jonathan Gardner <[EMAIL PROTECTED]> (was [EMAIL PROTECTED]) Live Free, Use Linux! -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iD8

Re: [SQL] [ADMIN] Latest transcation

2003-06-19 Thread Jonathan Gardner
go for a server-side solution (because the application doesn't know what was last inserted and when), then you'll want to use triggers as I described in a previous posting. - -- Jonathan Gardner <[EMAIL PROTECTED]> (was [EMAIL PROTECTED]) Live Free, Use Linux! -BEGIN PGP

Re: [SQL] [ADMIN] Notification

2003-06-17 Thread Jonathan Gardner
omer FOR EACH ROW EXECUTE PROCEDURE notify_on_update(); Now you set up your application to watch for the notification. When it receives the notification, if can update the displayed information. Is this a good starting place? - -- Jonathan Gardner <[EMAIL PROTECTED]> (was [E

Re: [SQL] Blobs with perl

2003-06-17 Thread Jonathan Gardner
tainly possible with PostgreSQL, it is a bit more complicated. And remember, while your database server is small now, it will grow, and grow, and grow, and grow. It will one day become the bottleneck in your operations. That is an inevitable fact of any dynamic website. - -- Jonathan Gardner <

Re: [SQL] SQL problem: bank account

2003-06-03 Thread Jonathan Gardner
On Monday 02 June 2003 00:49, listrec wrote: > How about: > > select max(transaction_id) from bank_account group by customer_id > And if you want the rest of the data in the rows: SELECT b.* FROM bank_account b JOIN ( SELECT max(transaction_id) AS transaction_id FROM bank_account

Re: [SQL] SQL problem: bank account

2003-06-03 Thread Jonathan Gardner
FROM bank_account GROUP BY customer_id ) AS subselect ON subselect.transaction_id=b.transaction_id ; I use a similar query here at work to find the first time a guy has visited our site through an advertiser. -- Jonathan Gardner <[EMAIL PROTECTED]> (was [EMAIL PROTECTED]) Li