Re: [PATCHES] WIP: pl/pgsql cleanup
Neil Conway [EMAIL PROTECTED] writes: On Tue, 2005-01-18 at 01:02 -0500, Tom Lane wrote: It might be better to keep CurrentMemoryContext pointing at a temp context, and translate malloc() to MemoryContextAlloc(function_context) rather than just palloc(). (Of course you could hide this in a macro, maybe falloc()?) Are there really enough short-lived pallocs that this is worth the trouble? Not sure, but it seems like at least as straightforward a translation as the other way. More to the point, it makes clear the difference between what is meant to be a long-lived data structure and what isn't. One potential issue is that there are plenty of places where we'd want to falloc(), but don't have the function easily available (e.g. in the parser). Why not? You'd need to keep the context-to-use in a static variable, but that's no great difficulty considering that plpgsql function parsing needn't be re-entrant. regards, tom lane ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
Re: [PATCHES] [pgsql-hackers-win32] pg_autovacuum fails to start - 8.0 Release
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harald Massa Sent: 20 January 2005 13:30 To: [EMAIL PROTECTED] Subject: [pgsql-hackers-win32] pg_autovacuum fails to start - 8.0 Release I am trying to install pg_autovacuum as a win32 service. pg_autovacuum -I -N ourdomain\postgres -W secretpassword -E pgsql-8.0 -d 4 -L c:\ghum\data\pg_log\autovacuum.log -U postgres -P moresecretpasswords when trying to start: C:\Programme\PostgreSQL\8.0\binsc start pg_autovacuum [SC] StartService FAILED 1075: Der Abhõngigkeitsdienst ist nicht vorhanden oder wurde zum L÷schen markiert. (english: 1075 The dependency service does not exist or has been marked for deletion. ERROR_SERVICE_DEPENDENCY_DELETED) It appears I didn't read the docs properly when I write that bit - the dependencies parameter passed to CreateService() is supposed to be double-null terminated - a subtle point I missed :-( The attached patch fixes this. Harald - I can email an updated .exe if you want to test, otherwise, you should be able to use the current version if you cleanup the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pg_autovacuum\DependOnService registry key. Regards, Dave pg_autovacuum.c.diff Description: pg_autovacuum.c.diff ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [PATCHES] [pgsql-hackers-win32] pg_autovacuum fails to start - 8.0 Release
-Original Message- From: Harald Massa [mailto:[EMAIL PROTECTED] Sent: 20 January 2005 16:07 To: Dave Page Cc: [EMAIL PROTECTED]; pgsql-patches@postgresql.org Subject: RE: [pgsql-hackers-win32] pg_autovacuum fails to start - 8.0 Release Dave, thank you very much for fixing the problem. No problem - sorry I messed up in the first place :-( Just to have it in the googleable space: you should be able to use the current version if you cleanup the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pg_autov acuum\DependOnService registry key. That is of no use. The service fails to start with exactly the same error message. (But, at least, I could see the problem within the registry :)) You probably need to restart after editting it so that the SCM reloads it. Regards, Dave ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [PATCHES] [pgsql-hackers-win32] pg_autovacuum fails to start - 8.0 Release
Dave, You probably need to restart after editting it so that the SCM reloads it. I am not quite sure if that really helped. Either way, I found a workaround and want to have it within googling space: at the moment the rest of the command-line after -E is stored within the DependOnService Property. So the easiest fix is to have -E as the last parameter when creating the pg_autovacuum service... that creates an DependOnService pgsql-8.0 Key-Entry within the registry and it works Harald ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
[PATCHES] regression: pass with no default WITH OIDS
This patch updates the regression tests to allow make installcheck to pass if default_with_oids is set to false. I took the approach of explicitly adding WITH OIDS to the CREATE TABLEs where necessary, rather than tweaking the default_with_oids GUC var. Barring any objections, I intend to apply this to HEAD and REL8_0_STABLE today or tomorrow. -Neil Index: src/test/regress/expected/alter_table.out === RCS file: /var/lib/cvs/pgsql/src/test/regress/expected/alter_table.out,v retrieving revision 1.85 diff -c -r1.85 alter_table.out *** src/test/regress/expected/alter_table.out 28 Aug 2004 22:06:04 - 1.85 --- src/test/regress/expected/alter_table.out 21 Jan 2005 01:03:57 - *** *** 318,324 drop table atacc2; drop table atacc1; -- test unique constraint adding ! create table atacc1 ( test int ); -- add a unique constraint alter table atacc1 add constraint atacc_test1 unique (test); NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index atacc_test1 for table atacc1 --- 318,324 drop table atacc2; drop table atacc1; -- test unique constraint adding ! create table atacc1 ( test int ) with oids; -- add a unique constraint alter table atacc1 add constraint atacc_test1 unique (test); NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index atacc_test1 for table atacc1 *** *** 378,384 ERROR: duplicate key violates unique constraint atacc1_test_key drop table atacc1; -- test primary key constraint adding ! create table atacc1 ( test int ); -- add a primary key constraint alter table atacc1 add constraint atacc_test1 primary key (test); NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index atacc_test1 for table atacc1 --- 378,384 ERROR: duplicate key violates unique constraint atacc1_test_key drop table atacc1; -- test primary key constraint adding ! create table atacc1 ( test int ) with oids; -- add a primary key constraint alter table atacc1 add constraint atacc_test1 primary key (test); NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index atacc_test1 for table atacc1 *** *** 476,482 ERROR: relation non_existent does not exist -- test setting columns to null and not null and vice versa -- test checking for null values and primary key ! create table atacc1 (test int not null); alter table atacc1 add constraint atacc1_pkey primary key (test); NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index atacc1_pkey for table atacc1 alter table atacc1 alter column test drop not null; --- 476,482 ERROR: relation non_existent does not exist -- test setting columns to null and not null and vice versa -- test checking for null values and primary key ! create table atacc1 (test int not null) with oids; alter table atacc1 add constraint atacc1_pkey primary key (test); NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index atacc1_pkey for table atacc1 alter table atacc1 alter column test drop not null; *** *** 598,604 alter table nosuchtable drop column bar; ERROR: relation nosuchtable does not exist -- test dropping columns ! create table atacc1 (a int4 not null, b int4, c int4 not null, d int4); insert into atacc1 values (1, 2, 3, 4); alter table atacc1 drop a; alter table atacc1 drop a; --- 598,604 alter table nosuchtable drop column bar; ERROR: relation nosuchtable does not exist -- test dropping columns ! create table atacc1 (a int4 not null, b int4, c int4 not null, d int4) with oids; insert into atacc1 values (1, 2, 3, 4); alter table atacc1 drop a; alter table atacc1 drop a; Index: src/test/regress/expected/copy2.out === RCS file: /var/lib/cvs/pgsql/src/test/regress/expected/copy2.out,v retrieving revision 1.19 diff -c -r1.19 copy2.out *** src/test/regress/expected/copy2.out 10 Jun 2004 17:56:01 - 1.19 --- src/test/regress/expected/copy2.out 21 Jan 2005 00:54:10 - *** *** 4,10 c text not null default 'stuff', d text, e text ! ); NOTICE: CREATE TABLE will create implicit sequence x_a_seq for serial column x.a CREATE FUNCTION fn_x_before () RETURNS TRIGGER AS ' BEGIN --- 4,10 c text not null default 'stuff', d text, e text ! ) WITH OIDS; NOTICE: CREATE TABLE will create implicit sequence x_a_seq for serial column x.a CREATE FUNCTION fn_x_before () RETURNS TRIGGER AS ' BEGIN Index: src/test/regress/expected/create_table.out === RCS file: /var/lib/cvs/pgsql/src/test/regress/expected/create_table.out,v retrieving revision 1.12 diff -c -r1.12 create_table.out *** src/test/regress/expected/create_table.out 25 Sep 2003 06:58:06 - 1.12 --- src/test/regress/expected/create_table.out 21 Jan 2005 00:57:09 - *** ***
Re: [PATCHES] WIP: pl/pgsql cleanup
On Thu, 2005-01-20 at 15:48 +1100, Neil Conway wrote: Attached is a revised patch (no major changes, just grammar cleanup). While rewriting some cruft in PL/PgSQL's gram.y, I noticed that we will overflow a heap-allocated array if the user specifies more than 1024 parameters to a refcursor (a demonstration .sql file is also attached). I think this is probably worth backpatching to 8.0 (and earlier?) -- I've attached a quick hack of a patch that fixes the issue, although of course the fix for 8.1 is nicer. I've applied the minimal fix for the buffer overrun to REL7_4_STABLE and REL8_0_STABLE (let me know if you think it's worth backpatching further). I'll post a revised patch for HEAD that does the falloc() stuff soon. -Neil ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [PATCHES] uptime function to postmaster
Bruce Momjian wrote: This has been saved for the 8.1 release: http:/momjian.postgresql.org/cgi-bin/pgpatches2 --- Hi, I redo this patch adding the funcionality that Matthias implemented (starttime). Basically I changed the uptime()'s return type to 'interval' (more funcional now, uh?) and rework in the Matthias function (start_time()). The last one return type is 'timestamp with time zone'. The docs are attached to, but maybe need some work on it. Comments? = Euler Taveira de Oliveira euler[at]yahoo_com_br ___ Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. http://br.acesso.yahoo.com/ - Internet rápida e grátis*** ./doc/src/sgml/func.sgml.orig 2005-01-20 18:23:48.0 -0200 --- ./doc/src/sgml/func.sgml2005-01-20 16:44:52.0 -0200 *** *** 8060,8065 --- 8060,8077 /row row +entryfunctionstart_time()/function/entry +entrytypetimestamp with time zone/type/entry +entryPostgreSQL startup date and time/entry + /row + + row +entryfunctionuptime()/function/entry +entrytypeinterval/type/entry +entryPostgreSQL uptime information/entry + /row + + row entryfunctionuser/function/entry entrytypename/type/entry entryequivalent to functioncurrent_user/function/entry *** *** 8157,8162 --- 8169,8192 /para indexterm zone=functions-info + primarystart_time/primary +/indexterm + +para + functionstart_time()/function returns the timestamp with time zone + which the productnamePostgreSQL/productname was started. +/para + +indexterm zone=functions-info + primaryuptime/primary +/indexterm + +para + functionuptime()/function returns the productnamePostgreSQL/ + uptime information. +/para + +indexterm zone=functions-info primaryversion/primary /indexterm *** ./src/backend/postmaster/postmaster.c.orig 2005-01-20 18:24:36.0 -0200 --- ./src/backend/postmaster/postmaster.c 2005-01-20 16:44:52.0 -0200 *** *** 221,226 --- 221,229 bool ClientAuthInProgress = false; /* T during new-client * authentication */ + /* Backend startup time */ + TimestampTz StartTime; + /* * State for assigning random salts and cancel keys. * Also, the global MyCancelKey passes the cancel key assigned to a given *** *** 329,334 --- 332,338 InheritableSocket pgStatPipe0; InheritableSocket pgStatPipe1; pid_t PostmasterPid; + TimestampTz StartTime; #ifdef WIN32 HANDLE PostmasterHandle; HANDLE initial_signal_pipe; *** *** 371,376 --- 375,383 char *userDoption = NULL; int i; + AbsoluteTimeStartTimeSec; /* integer part */ + int StartTimeUSec; /* microsecond part */ + /* This will call exit() if strdup() fails. */ progname = get_progname(argv[0]); *** *** 915,920 --- 922,933 */ StartupPID = StartupDataBase(); + /* +* Get start up time +*/ + StartTimeSec = GetCurrentAbsoluteTimeUsec(StartTimeUSec); + StartTime = AbsoluteTimeUsecToTimestampTz(StartTimeSec, StartTimeUSec); + status = ServerLoop(); /* *** *** 3669,3674 --- 3682,3688 write_inheritable_socket(param-pgStatPipe1, pgStatPipe[1], childPid); param-PostmasterPid = PostmasterPid; + param-StartTime = StartTime; #ifdef WIN32 param-PostmasterHandle = PostmasterHandle; *** *** 3871,3876 --- 3885,3891 read_inheritable_socket(pgStatPipe[1], param-pgStatPipe1); PostmasterPid = param-PostmasterPid; + StartTime = param-StartTime; #ifdef WIN32 PostmasterHandle = param-PostmasterHandle; *** ./src/backend/tcop/postgres.c.orig 2005-01-20 18:39:18.0 -0200 --- ./src/backend/tcop/postgres.c 2005-01-20 18:15:07.0 -0200 *** *** 144,149 --- 144,152 #endif /* TCOP_DONTUSENEWLINE */ + /* Backend startup time */ + TimestampTz StartTime; + /* *decls for routines only used in this file * *** *** 2217, --- 2220,2228 sigjmp_buf local_sigjmp_buf; volatile bool send_rfq = true; + AbsoluteTimeStartTimeSec;