[GENERAL] How to retrieve number of rows affected, in an after statement trigger?

2007-07-07 Thread Zlatko Matic
Hello. Is it possible to retrieve information about how many rows were changed/inserted in a table that fired after statement trigger? Thanks, Zlatko ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Update a single row without firing its triggers?

2007-07-07 Thread Zlatko Matic
Hello. These days I was trying to temporarily disable triggers, too, and had much problems with ALTER TABLE..DISABLE TRIGGER ALL. So, I was googling for another solution and have found this: http://www.varlena.com/GeneralBits/101.php. Works OK in my case... Turn off triggers for

Re: [GENERAL] CASE in ORDER BY clause

2007-07-07 Thread Louis-David Mitterrand
On Fri, Jul 06, 2007 at 08:02:54PM +0400, Viatcheslav Kalinin wrote: Louis-David Mitterrand wrote: # select start_date from show_date # order by # case when start_date CURRENT_DATE then start_date end desc, # case when start_date = CURRENT_DATE then start_date end asc; But... this works!

Re: [GENERAL] CASE in ORDER BY clause

2007-07-07 Thread Louis-David Mitterrand
On Fri, Jul 06, 2007 at 08:02:54PM +0400, Viatcheslav Kalinin wrote: # select start_date from show_date # order by # case when start_date CURRENT_DATE then start_date end desc, # case when start_date = CURRENT_DATE then start_date end asc; The strange thing is when I try: select

[GENERAL] Unable to get postgres running after long time no vacuum

2007-07-07 Thread Leon Mergen
Hello, Okay, I was stupid -- I didn't check my database server for a while (vacation), returned, and found out I didn't run vacuum for a too long time: bash-3.1$ psql --version psql (PostgreSQL) 8.1.9 contains support for command-line editing bash-3.1$ psql psql: FATAL: database is not

[GENERAL] Unable to get postgres running after long time no vacuum

2007-07-07 Thread Leon Mergen
Hello, Okay, I was stupid -- I didn't check my database server for a while (vacation), returned, and found out I didn't run vacuum for a too long time: bash-3.1$ psql --version psql (PostgreSQL) 8.1.9 contains support for command-line editing bash-3.1$ psql psql: FATAL: database is not

Re: [GENERAL] How to retrieve number of rows affected, in an after statement trigger?

2007-07-07 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Is it possible to retrieve information about how many rows were changed/inserted in a table that fired after statement trigger? Not directly, but you can store the information from row-level triggers and gather it at the end. See this

Re: [GENERAL] Unable to get postgres running after long time no vacuum

2007-07-07 Thread Tom Lane
Leon Mergen [EMAIL PROTECTED] writes: Now, I enter a 'vacuum verbose;' and wait for about a day (the database is 1TB in size) -- it completes, and I start the database again; it starts replaying the +- 1K WAL log files for a while, and after completion, I try to attempt to connect to the

Re: [GENERAL] Update a single row without firing its triggers?

2007-07-07 Thread Scott Ribe
Why not just write the trigger function as: if old.a is distinct from new.a or old.b is distinct from new.b ... end if -- Scott Ribe [EMAIL PROTECTED] http://www.killerbytes.com/ (303) 722-0567 voice ---(end of broadcast)--- TIP 6: explain

[GENERAL] Arrays of records?

2007-07-07 Thread Chris Travers
Hi all; I was wondering how one would define an array of complex data types or records. Any ideas or is this simply not supported? Best Wishes, Chris Travers ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your

Re: [GENERAL] CASE in ORDER BY clause

2007-07-07 Thread Gregory Stark
Louis-David Mitterrand [EMAIL PROTECTED] writes: However if I try: select start_date from show_date order by 'start_date desc'; I get a: ERROR: non-integer constant in ORDER BY The quotes mean you are asking to sort by the string start_date desc which is an error because

Re: [GENERAL] CASE in ORDER BY clause

2007-07-07 Thread Perry Smith
On Fri, Jul 06, 2007 at 08:02:54PM +0400, Viatcheslav Kalinin wrote: # select start_date from show_date # order by # case when start_date CURRENT_DATE then start_date end desc, # case when start_date = CURRENT_DATE then start_date end asc; I am very novice, but that looks odd to me. I would

[GENERAL] catalog location

2007-07-07 Thread Carmen Martinez
Please, I need to know where the catalog tables (pg_class, pg_attrdef...) are located in the postgresql rdbms. Because I can not see them in the pgAdminII interface, like other tables or objects. And I can not find any reference about where this information is, please any help would be welcome.

Re: [GENERAL] CASE in ORDER BY clause

2007-07-07 Thread Tom Lane
Perry Smith [EMAIL PROTECTED] writes: On Fri, Jul 06, 2007 at 08:02:54PM +0400, Viatcheslav Kalinin wrote: # select start_date from show_date # order by # case when start_date CURRENT_DATE then start_date end desc, # case when start_date = CURRENT_DATE then start_date end asc; I am very

Re: [GENERAL] CASE in ORDER BY clause

2007-07-07 Thread Martijn van Oosterhout
On Sat, Jul 07, 2007 at 01:49:09PM -0500, Perry Smith wrote: # select start_date from show_date # order by # case when start_date CURRENT_DATE then start_date end desc, # case when start_date = CURRENT_DATE then start_date end asc; I am very novice, but that looks odd to me. I would have

Re: [GENERAL] CASE in ORDER BY clause

2007-07-07 Thread Perry Smith
On Jul 7, 2007, at 2:15 PM, Tom Lane wrote: Perry Smith [EMAIL PROTECTED] writes: On Fri, Jul 06, 2007 at 08:02:54PM +0400, Viatcheslav Kalinin wrote: # select start_date from show_date # order by # case when start_date CURRENT_DATE then start_date end desc, # case when start_date =

[GENERAL] Crash in PostgreSQL-8.2.4 while executing query

2007-07-07 Thread rupesh bajaj
Hi, When I run the following query Postmaster crashes. For your reference I have attached information regarding the query (query plan, table , index, server log). My observation is that when Postmaster starts taking lot of memory because of which system runs out of memory and OS kills the

Re: [GENERAL] How to retrieve number of rows affected, in an after statement trigger?

2007-07-07 Thread Zlatko Matić
Thank you for the answer. At least I'm glad it is possible! But , as I don't know Perl, could you, please, tell me how to accomplish it in plpgsql. Thanks, Zlatko - Original Message - From: Greg Sabino Mullane [EMAIL PROTECTED] To: pgsql-general@postgresql.org Sent: Saturday, July

Re: [GENERAL] Arrays of records?

2007-07-07 Thread Pavel Stehule
Hello you can test it. PostgreSQL 8.3 supports it. postgres=# CREATE TYPE at AS (a integer, b integer); CREATE TYPE postgres=# CREATE TABLE foo(a at[]); CREATE TABLE postgres=# INSERT INTO foo VALUES(ARRAY[(10,20)::at]); INSERT 0 1 postgres=# INSERT INTO foo VALUES(ARRAY[(10,20)::at,

Re: [GENERAL] Crash in PostgreSQL-8.2.4 while executing query

2007-07-07 Thread Tom Lane
rupesh bajaj [EMAIL PROTECTED] writes: When I run the following query Postmaster crashes. ... LOG: background writer process (PID 5808) was terminated by signal 9 LOG: terminating any other active server processes LOG: statistics collector process (PID 5809) was terminated by signal 9

Re: [GENERAL] Crash in PostgreSQL-8.2.4 while executing query

2007-07-07 Thread Scott Marlowe
On 7/7/07, rupesh bajaj [EMAIL PROTECTED] wrote: Hi, When I run the following query Postmaster crashes. For your reference I have attached information regarding the query (query plan, table , index, server log). My observation is that when Postmaster starts taking lot of memory because of which

Re: [GENERAL] Problem with autovacuum and pg_autovacuum

2007-07-07 Thread Andreas 'ads' Scherbaum
On Sat, 7 Jul 2007 00:12:32 +0200 Andreas 'ads' Scherbaum wrote: On Fri, 6 Jul 2007 12:06:41 -0400 Alvaro Herrera wrote: Andreas 'ads' Scherbaum wrote: The value is '0' for all columns in all entries, except 'vacrelid' and 'enabled'. Can a VACUUM run happen, even if enabled is set

[GENERAL] Changing DB Encodings

2007-07-07 Thread Naz Gassiep
Why have I been told that I need to do a re initdb to change the char encoding? The man says i can just createdb foodb -E utf8so why would i need to dump/initdb/create/restore? cant i just dump/create/restore? It'd save all the messing around with changing the data dirs etc.

Re: [GENERAL] Changing DB Encodings

2007-07-07 Thread Tom Lane
Naz Gassiep [EMAIL PROTECTED] writes: Why have I been told that I need to do a re initdb to change the char encoding? The man says i can just createdb foodb -E utf8so why would i need to dump/initdb/create/restore? cant i just dump/create/restore? Are you clear on the difference

Re: [GENERAL] catalog location

2007-07-07 Thread Raymond O'Donnell
On 07/07/2007 20:06, Carmen Martinez wrote: Please, I need to know where the catalog tables (pg_class, pg_attrdef...) are located in the postgresql rdbms. Because I can not see them in the pgAdminII interface, like other tables or objects. And I There is a separate list for pgAdmin

Re: [GENERAL] Changing DB Encodings

2007-07-07 Thread Naz Gassiep
Tom Lane wrote: Are you clear on the difference between encoding and locale? I confidently reply with maybe. You can make new databases with whatever encoding you say, but the server's lc_collate and lc_ctype are frozen at initdb, and it will not work well to select an encoding that is

Re: [GENERAL] Changing DB Encodings

2007-07-07 Thread Tom Lane
Naz Gassiep [EMAIL PROTECTED] writes: OK I understand now, I think. How do I check what locale is currently set? show lc_collate (maybe check the other lc_ settings too for luck). I've successfully created a utf8 database, does that imply that because I was able to create a DB with a

Re: [GENERAL] Changing DB Encodings

2007-07-07 Thread Naz Gassiep
Tom Lane wrote: I've successfully created a utf8 database, does that imply that because I was able to create a DB with a different encoding to the ones all the others use (SQL_ASCII) that my locale is set to C ? No, that implies a lack of error checking. Surely, then, that's a bug?

Re: [GENERAL] Changing DB Encodings

2007-07-07 Thread Tom Lane
Naz Gassiep [EMAIL PROTECTED] writes: Tom Lane wrote: No, that implies a lack of error checking. Surely, then, that's a bug? Shouldn't postmaster check if a DB is in an encoding that differs from the selected locale? Yeah, it should. Whether it can is a different question. Part of the