Re: [PATCHES] ruleutils with pretty-print option

2003-07-02 Thread Andreas Pflug
The patch has been updated, the attached files will replace my previous post completely against ruleutils.c 1.143. pg_get_indexdef is extended to take 3 arguments: pg_get_indexdef(index_oid, columnNr_int, prettyOpt_int) Still, pg_get_indexdef(oid) will deliver the same result as it used to be. Th

[PATCHES] ruleutils with pretty-print option

2003-07-06 Thread Andreas Pflug
Is there a problem about the archive? I posted this addition to the patch on July 2, and received it over the patches mailing list. Still, it doesn't appear in cvs, in "unapplied patches" or in the mailing list archive! So although that message made its way through the list server, it didn't end

Re: [PATCHES] ruleutils with pretty-print option

2003-07-21 Thread Andreas Pflug
Hi Bruce, so here's the complete patch against the current cvs. Description: The attached patches will add pg_get_ruledef(oid, bool) pg_get_viewdef(text, bool) pg_get_viewdef(oid, bool) pg_get_indexdef(oid, int4, bool) pg_get_constraintdef(oid, bool) pg_get_expr(text, oid, bool) If the

Re: [PATCHES] ruleutils with pretty-print option

2003-07-22 Thread Andreas Pflug
Bruce Momjian wrote: Andreas, looks good, but I need a diff -c, context diff. Hi Bruce, I intentionally only attached only non-context diffs because the patch is about 50 % size of the original file. Now, here's the same as context diff. Regards, Andreas Index: pg_proc.h ===

Re: [PATCHES] ruleutils with pretty-print option

2003-07-27 Thread Andreas Pflug
Bruce Momjian wrote: Tom Lane wrote: Bruce Momjian <[EMAIL PROTECTED]> writes: Tom, how do I pass PG_FUNCTION_ARGS to another function, while adding a new parameter? I wouldn't. Do the PG_GETARGS in the wrapper, and have the called function take a normal C parameter list. So I

Re: [PATCHES] ruleutils with pretty-print option

2003-07-28 Thread Andreas Pflug
Tom Lane wrote: Andreas Pflug <[EMAIL PROTECTED]> writes: + int prettyFlags = !PG_ARGISNULL(1) && PG_GETARG_BOOL(1) ? PRETTYFLAG_PAREN|PRETTYFLAG_INDENT : 0; Since the pg_proc entries are all marked strict, it's unnecessary for you to write any ARGISNULL

Re: [PATCHES] ruleutils with pretty-print option

2003-07-31 Thread Andreas Pflug
Tom Lane wrote: Applied with some editorializing. In particular, I don't believe the original did the right thing with (a - (b - c)). Oops, missed that case... But now, we have (a + ( b + c)) again. A patch that removes parentheses for + and * is appended. Regards, Andfdsa

[Fwd: Re: [PATCHES] ruleutils with pretty-print option]

2003-07-31 Thread Andreas Pflug
Now the patch is *really* appended :-) Tom Lane wrote: Applied with some editorializing. In particular, I don't believe the original did the right thing with (a - (b - c)). Oops, missed that case... But now, we have (a + ( b + c)) again. A patch that removes parentheses for + and * is appende

Re: [Fwd: Re: [PATCHES] ruleutils with pretty-print option]

2003-07-31 Thread Andreas Pflug
Tom Lane wrote: Now the patch is *really* appended :-) And rejected. Ok, the ckeck for node being the first child already does the trick for standard l-t-r evaluation. You cannot assume that an operator is commutative or associative just because it has a name you think ought to be. (For

Re: [Fwd: Re: [PATCHES] ruleutils with pretty-print option]

2003-07-31 Thread Andreas Pflug
Tom Lane wrote: Andreas Pflug <[EMAIL PROTECTED]> writes: Well, to me it's not well-known that floating-point addition is not associative, do I need to re-learn my math? regression=# select (1.0::float8 + (-1.0::float8)) + 1.0e-20::float8; ?column? -- 1e-20 (1 row)

[PATCHES] win32 libpq

2003-08-24 Thread Andreas Pflug
The attached patch allows libpq to be compiled under native win32. It adds the missing thread.c. Additionally, it corrects the option to compile for debugging. Regards, Andreas RCS file: /projects/cvsroot/pgsql-server/src/include/pg_config.h.win32,v retrieving revision 1.11 diff -u -r1.11 pg_conf

[PATCHES] non-blocking libpq under win32

2003-08-24 Thread Andreas Pflug
The attached patch reenables non-blocking operation under win32. The global variable was left uninitialized, so the compiler would silently make it 0. This resulted in connectMakeNonblocking() setting nonblocking to zero, i.e. blocking. Regards, Andreas RCS file: /projects/cvsroot/pgsql-server

[PATCHES] libpq with ssl under win32

2003-08-25 Thread Andreas Pflug
The attached patch enables libpq to be linked with ssl support (openssl 0.9.7.b tested). Client certificates are commented out because the implementation is *nix specific, regarding the location resolution of the .pem files. It needs to be discussed where these files should be located. For NT/W2

[PATCHES] non-blocking libpq under win32

2003-08-25 Thread Andreas Pflug
The attached patch reenables non-blocking operation under win32. The global variable was left uninitialized, so the compiler would silently make it 0. This resulted in connectMakeNonblocking() setting nonblocking to zero, i.e. blocking. Regards, Andreas RCS file: /projects/cvsroot/pgsql-server/

[PATCHES] libpq-win32 patches

2003-08-31 Thread Andreas Pflug
Hm, I don't see any reaction on my posts from last sunday, neither in this list nor in unapplied patches, did they get lost? If so, attached is a combined patch for all three problems with libpq compiling under win32. Regards, Andreas cvs diff -u interfaces\libpq\fe-connect.c interfaces\libpq\f

[PATCHES] IPV4 addresses on IPV6 machines in pg_hba.conf

2003-09-03 Thread Andreas Pflug
This was discussed in [HACKERS] TCP/IP with 7.4 beta2 broken? I created a patch to hba.c which uses IPV4 entries as IPV6 entries if running on a IPV6 system (which is detected from a port coming in as AF_INET6). 192.168.0.0/24 -> :::102.168.0/120 192.168.0.0 255.255.255.0 ->

Re: [PATCHES] IPV4 addresses on IPV6 machines in pg_hba.conf

2003-09-04 Thread Andreas Pflug
Kurt Roeckx wrote: You're assuming all systems have an AF_INET6 constant, which is not the case. Please make use of HAVE_IPV6. Can't directly see anything else wrong with it. Here's the patch with HAVE_IPV6 conditional compiling. Regards, Andreas Index: hba.c ===

Re: [PATCHES] libpq-win32 patches

2003-09-05 Thread Andreas Pflug
Hi Bruce, + +/* getpwuid doesn't exist under win32 */ +#define getpwuid(uid) NULL + #endif /* pg_config_h_win32__ */ Why was this needed? I realize we don't have getpwuid() on Win32, but we do have GetUserName() for cases where we need the name but not the directory. Because all the getpwui

Re: [PATCHES] IPV4 addresses on IPV6 machines in pg_hba.conf

2003-09-05 Thread Andreas Pflug
Andrew Dunstan wrote: Andreas, You should check that the CIDR mask is a valid integer. You would need to use strtol() rather than atoi() to do that. Perhaps this should be hoisted out of ip.c:SockAddr_cidr_mask() and put in hba.c. Right, I added this. Regards, Andreas Index: hba.c ===

Re: [PATCHES] IPV4 addresses on IPV6 machines in pg_hba.conf

2003-09-05 Thread Andreas Pflug
Tom Lane wrote: I thought this was still really messy, so I modified it to use a separate "promote v4 address to v6" subroutine. I've applied the attached patch (plus docs). It's not very well tested since I don't have an IPv6 setup here; please check that it does what you want. It SEGVs. Reason

Re: [PATCHES] IPV4 addresses on IPV6 machines in pg_hba.conf

2003-09-05 Thread Andreas Pflug
Tom Lane wrote: IMHO the struct needs to be created officially by getaddrinfo(), which will lead more or less the the same solution I posted previously. No, we just need to use datastructures that are under our control for the values that will get passed to rangeSockAddr. A few more lin

Re: [PATCHES] Unixware 713 probs

2003-09-07 Thread Andreas Pflug
Larry Rosenman wrote: Here's a quickie patch I did to fix it. Patching this or not, if the function's called the backend will SEGV either (at least on my 2.4.20 it does) because a IPV6 address is copied in the memory space of a IPV4 address. Regards, Andreas ---(end o

Re: [PATCHES] Unixware 713 probs

2003-09-08 Thread Andreas Pflug
Tom Lane wrote: Andreas Pflug <[EMAIL PROTECTED]> writes: Larry Rosenman wrote: Here's a quickie patch I did to fix it. Patching this or not, if the function's called the backend will SEGV either (at least on my 2.4.20 it does) because a IPV6 address is copie

Re: [PATCHES] preliminary: logical column order

2003-11-30 Thread Andreas Pflug
I wonder if it wouldn't be easier to reorder the TupDesc->attrs[] array according to an attphysid when filling the TupDesc structure, right after a column was dropped/recreated (before any indexes/constraints are recreated), so attnum remains, while storage changes. Example: before: attnum attph

[PATCHES] libpq endless loop if client_min_messages=debug1

2003-12-28 Thread Andreas Pflug
My Deja wrote: I am trying to get some query trees to appear in the PostgreSQL log and in order to that I have set client_min_messages = DEBUG1 in order to use the following settings debug_print_parse, debug_print_rewritten, or debug_print_plan which are required for the query tree to show up

[PATCHES] thread safety testing fix

2004-05-28 Thread Andreas Pflug
When checking for thread safety with src/tools/thread/thread_test.c, the mktemp function wants an argument that contains 6 X, while the current version only supplies 5 X which will fail on my SuSE 8.1. Patch attached. Regards, Andreas Index: thread_test.c

[PATCHES] Compiling libpq with VisualC

2004-05-28 Thread Andreas Pflug
Some modifications are needed to compile libpq with vc6: fe-connect.c: - pg_config_paths.h isn't available. SYSCONFDIR is already defined so fe-connect.c doesn't need to include that. patch appended win32.mak: - pg_config.h must be generated - port/pgstrcasecmp.c is needed - port/path.c is not ne

[PATCHES] Libpq ssl fix

2004-05-28 Thread Andreas Pflug
init_ssl_system will return 0 on success and -1 on failure, which will be interpreted just the other way round in initialize_SSL. Patch appended. Regards, Andreas Index: fe-secure.c === RCS file: /projects/cvsroot/pgsql-server/src/i

Re: [PATCHES] Libpq ssl fix

2004-05-28 Thread Andreas Pflug
Manfred Spraul wrote: Btw, --enable-thread-safety on Linux (RedHat Fedora Core 1) fails in configure with configure: error: *** Thread test program failed. Your platform is not thread-safe. *** Check the file 'config.log'for the exact reason. I had this too, for two reasons: - configure checks

Re: [PATCHES] thread safety testing fix

2004-05-28 Thread Andreas Pflug
Tom Lane wrote: Andreas Pflug <[EMAIL PROTECTED]> writes: When checking for thread safety with src/tools/thread/thread_test.c, the mktemp function wants an argument that contains 6 X, while the current version only supplies 5 X which will fail on my SuSE 8.1. Patch attached. Isn&

Re: [PATCHES] Libpq ssl fix

2004-05-28 Thread Andreas Pflug
Tom Lane wrote: Andreas Pflug <[EMAIL PROTECTED]> writes: init_ssl_system will return 0 on success and -1 on failure, which will be interpreted just the other way round in initialize_SSL. Patch appended. Hmm, that looks backwards to me too, but this would seem to imply that M

Re: [PATCHES] Compiling libpq with VisualC

2004-06-03 Thread Andreas Pflug
Bruce Momjian wrote: fe-connect.c: - pg_config_paths.h isn't available. SYSCONFDIR is already defined so fe-connect.c doesn't need to include that. patch appended This shouldn't be needed anymore. Where is SYSCONFDIR coming from? Is it from some Win32 include file? It should only be c

Re: [PATCHES] Compiling libpq with VisualC

2004-06-04 Thread Andreas Pflug
Bruce Momjian wrote: Andreas Pflug wrote: Bruce Momjian wrote: fe-connect.c: - pg_config_paths.h isn't available. SYSCONFDIR is already defined so fe-connect.c doesn't need to include that. patch appended This shouldn't be needed anymore. Wher

Re: [PATCHES] Compiling libpq with VisualC

2004-06-04 Thread Andreas Pflug
Andreas Pflug wrote: The attached patch will create a dummy pg_config_paths.h. Additionally, ENABLE_THREAD_SAFETY is supported by the makefile (but not by the sources, which need some rework) Now including the patch... Regards, Andreas Index: win32.mak

Re: [PATCHES] Compiling libpq with VisualC

2004-06-04 Thread Andreas Pflug
The appended patch implements ENABLE_THREAD_SAFETY for win32 compiled with Visual C. Two additional files will supply the needed pthread stuff. There's no SIGPIPE for native win32, so there are some #IFNDEF WIN32 to skip installing a signal handler for this. I'm not sure if this is going to sho

[PATCHES] Int2 vector to array equality

2004-06-06 Thread Andreas Pflug
While trying to pg_constraint JOIN pg_index ON indrelid=conrelid AND conkey=indkey I noticed (once again) that these columns have different types (although describing the same thing), and there's no equality operator for them. The attached patch adds an equality operator bool int2array_int2vec

Re: [PATCHES] Int2 vector to array equality

2004-06-07 Thread Andreas Pflug
Tom Lane wrote: Andreas Pflug <[EMAIL PROTECTED]> writes: The attached patch adds an equality operator bool int2array_int2vector_eq(int2[], int2vector) This seems like a remarkably specialized kluge ... gotta be a better way ... How? This could be coded to support any elemen

Re: [PATCHES] [HACKERS] serverlog function (log_destination file)

2004-06-08 Thread Andreas Pflug
Magnus Hagander wrote: Specifically about the logs, I still think there is a lot of value to being able to read the logs remotely even if you can't restart postmaster. Since I believe that retrieving the logs easily without server file access is a feature that's welcomed by many users, here's my p

Re: [PATCHES] [HACKERS] serverlog function (log_destination file)

2004-06-10 Thread Andreas Pflug
Tom Lane wrote: Bruce Momjian <[EMAIL PROTECTED]> writes: Looks good to me. The only issue I saw was that the default file name mentioned in postgresql.conf doesn't match the actual default. I'm really not happy with the concept that the postmaster overrides its stderr direction. I agre

Re: [PATCHES] [HACKERS] serverlog function (log_destination file)

2004-06-10 Thread Andreas Pflug
Sorry I didn't get back on this earlier, yesterday morning my internet access was literally struck by lightning, I'm running temporary hardware now. Bruce Momjian wrote: Looks good to me. The only issue I saw was that the default file name mentioned in postgresql.conf doesn't match the actual d

Re: [PATCHES] Compiling libpq with VisualC

2004-06-11 Thread Andreas Pflug
Bruce Momjian wrote: I have looked over this patch. I noticed this: -static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER; - +static pthread_mutex_t init_mutex; +static int mutex_initialized = 0; +if (!mutex_initiali

Re: [PATCHES] Compiling libpq with VisualC

2004-06-11 Thread Andreas Pflug
Bruce Momjian wrote: Agreed. My pthread book says pthread_mutex_init() should be called only once, and we have to guarantee that. If the Windows implentation allows it to be called multiple times, just create a function to be called only by Win32 that does that and leave the Unix safe. Ok, so

Re: [PATCHES] [HACKERS] serverlog function (log_destination file)

2004-06-11 Thread Andreas Pflug
Bruce Momjian wrote: I was thinking of close/reopen so log files could be rotated. Log file rotation is fine, if we find a consensus quite soon how to implement it... Seems as if I might find some time to implement it until feature freeze. The attached patch has the default filename issue fix

Re: [PATCHES] [HACKERS] serverlog function (log_destination file)

2004-06-11 Thread Andreas Pflug
Tom Lane wrote: This has got portability issues (fopen("ab")) My doc says b is ignored on ansi systems, and recommends using it. Do you have other experiences? and I don't care for its use of malloc in preference to palloc either. Do we already have an applicable memory context in the postmast

Re: [PATCHES] Compiling libpq with VisualC

2004-06-11 Thread Andreas Pflug
Manfred Spraul wrote: Wrong. There are portable test-and-set functions in the Win32 SDK: for example InterlockedCompareExchange. They operate on ints and do not need initialization. 'k, missed that one. Lets use it. There is a third option: Add one C++ file and use the constructor to initialize

[PATCHES] win32 libpq ENABLE_THREAD_SAFETY

2004-06-13 Thread Andreas Pflug
So here's the updated ENABLE_THREAD_SAFETY patch for win32, to be compiled under VC5/6/7 (tested with VC6). nmake -f win32.mak [DEBUG=1] [USE_SSL=1] [ENABLE_THREAD_SAFETY=1] are supported. Regards, Andreas /*- * * pthread-win

Re: [PATCHES] stderr & win32 admin check

2004-06-15 Thread Andreas Pflug
Dave Page wrote: It could still be run on NT4 under the following conditions: 1) Running as a service 2) Running if the user logged in is not an administrator. Well, isn't "running as a service" sufficient? I thought that was the only interesting case for non-hackers anyway. As long as y

Re: [PATCHES] stderr & win32 admin check

2004-06-15 Thread Andreas Pflug
Dave Page wrote: you can only run one instance as a service on a single machine. If you mean only run one instance of postmaster as service, that's not true. If you like two pgsql servers (i.e. db clusters), you can install two services, both using the same binary with different cmd line argume

Re: [PATCHES] Tablespace patch review

2004-06-18 Thread Andreas Pflug
Gavin Sherry wrote: On Fri, 18 Jun 2004, Bruce Momjian wrote: [snip] TODO. You sound like a man who's expecting a several-generations-polished facility when we only just committed the first version today. I do not feel a need to have any of these features in 7.5 ... I just need to know

Re: [PATCHES] Tablespace patch review

2004-06-18 Thread Andreas Pflug
Gavin Sherry wrote: On Fri, 18 Jun 2004, Andreas Pflug wrote: Gavin Sherry wrote: On Fri, 18 Jun 2004, Bruce Momjian wrote: [snip] TODO. You sound like a man who's expecting a several-generations-polished facility when we only just committed the first version today. I do not

Re: [PATCHES] Tablespace patch review

2004-06-18 Thread Andreas Pflug
Gavin Sherry wrote: I would debate that. Firstly, tablespaces aren't supported on windows yet. Just a matter of time. And I'm talking of win32 workstations connecting to *ix servers too. Secondly, I'd think that Unix users would be fine with a command line tool, especially one that can connect to

Re: [PATCHES] Tablespace patch review

2004-06-18 Thread Andreas Pflug
Tom Lane wrote: Andreas Pflug <[EMAIL PROTECTED]> writes: IMHO checking objects in a tablespace is a routine administrative task, so it should be supported natively by the server without need of contribs. I strongly disagree. Dropping a tablespace is not a routine activity, Dr

Re: [PATCHES] Tablespace patch review

2004-06-19 Thread Andreas Pflug
Tom Lane wrote: Andreas Pflug <[EMAIL PROTECTED]> writes: Tom Lane wrote: As for the authentication-is-expensive issue, what of it? You *should* have to authenticate yourself in order to look inside another person's database. The sort of cross-database inspection being pr

Re: [PATCHES] Tablespace patch review

2004-06-19 Thread Andreas Pflug
Dave Page wrote: -Original Message- From: [EMAIL PROTECTED] on behalf of Bruce Momjian Sent: Sat 6/19/2004 1:05 AM To: Andreas Pflug Cc: Tom Lane; Gavin Sherry; PostgreSQL-patches Subject: Re: [PATCHES] Tablespace patch review We can build a gui on top of the command-line tool, no? No

Re: [PATCHES] Tablespace patch review

2004-06-19 Thread Andreas Pflug
Bruce Momjian wrote: I don't see why an admin tool can't connect to each database and get a listing of what is in each tablespace. I don't think connecting to 100 databases to get that information will be slow. Well, whatever you call slow or not slow. I checked it; connecting 10 databases, re

Re: [PATCHES] Tablespace patch review

2004-06-19 Thread Andreas Pflug
Dave Page wrote: -Original Message- From: Andreas Pflug [mailto:[EMAIL PROTECTED] Sent: Sat 6/19/2004 6:40 PM To: Bruce Momjian Cc: Dave Page; Tom Lane; PostgreSQL-patches Subject: Re: [PATCHES] Tablespace patch review Well, whatever you call slow or not slow. I checked it; connecting

Re: [PATCHES] Compiling libpq with VisualC

2004-06-19 Thread Andreas Pflug
Two minor tweaks: in libpq-be.h isn't present on win32 vc6. Apparently, it isn't used in Linux either; libpq will compile without it. All usages of gettimeofday throughout the backend don't seem connection related, so libpq-be.h seems an odd place to include it. ERROR in elog.h has conflicts w

Re: [PATCHES] Compiling libpq with VisualC

2004-06-20 Thread Andreas Pflug
Tom wrote: It's there to declare struct timeval, and I'm fairly certain that diking it out of the header would break things on some platforms. Where does Windows define struct timeval? struct timeval is defined in winsock.h under vc6. I'm checking for _MSC_VER now. Agreed. We define FRONTEND

[PATCHES] serverlog rotation/functions

2004-06-28 Thread Andreas Pflug
The attached patch includes serverlog rotation with minimal shared memory usage as discussed and functions to access it. Regards, Andreas Index: doc/src/sgml/func.sgml === RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/func.sg

[PATCHES] pg_tablespace_databases

2004-06-28 Thread Andreas Pflug
From an idea of Bruce, the attached patch implements the function pg_tablespace_databases(oid) RETURNS SETOF oid which delivers as set of database oids having objects in the selected tablespace, enabling an admin to examine only the databases affecting the tablespace for objects instead of scanni

Re: [PATCHES] pg_tablespace_databases

2004-06-28 Thread Andreas Pflug
Andreas Pflug wrote: From an idea of Bruce, the attached patch implements the function pg_tablespace_databases(oid) RETURNS SETOF oid which delivers as set of database oids having objects in the selected tablespace, enabling an admin to examine only the databases affecting the tablespace for

Re: [PATCHES] patch queue reminder

2004-06-30 Thread Andreas Pflug
Fabien COELHO wrote: Dear patchers, I have two minor patches that are being submitted but which do not appear yet in the "official" patch queue on the web site: http://momjian.postgresql.org/cgi-bin/pgpatches That site is maintained by Bruce, who is out to Armenia until next week, with virtua

Re: [PATCHES] pg_tablespace_databases

2004-07-01 Thread Andreas Pflug
Joe Conway wrote: If there are no objections, I'll review and apply this tonight (west coast USA time). Andreas, please provide a corresponding documentation patch. Here we are. Since I don't have a SGML build environment, syntax is not checked. Regards, Andreas Index: func.sgml =

Re: [PATCHES] pg_tablespace_databases

2004-07-02 Thread Andreas Pflug
Joe Conway wrote: Attached is the patch I plan to apply. There are a couple of changes from what was posted. 1) You must have meant tablespace instead of namespace here: + + pg_tablespace_databases(namespace_oid) + setof

Re: [PATCHES] serverlog rotation/functions

2004-07-06 Thread Andreas Pflug
Tom Lane wrote: Andreas Pflug <[EMAIL PROTECTED]> writes: The attached patch includes serverlog rotation with minimal shared memory usage as discussed and functions to access it. This patch is still unsafe and unworkable. Why would you make the mechanism dependent on shared memor

Re: [PATCHES] serverlog rotation/functions

2004-07-06 Thread Andreas Pflug
Updated version. Only timestamp of fresh logfile in shared mem, with sanity checks. On SIGHUP, timestamp is checked if rotation was issued, as well as changed log_filename setting from postgresql.conf. Regards, Andreas Index: src/backend/postmaster/postmaster.c ==

Re: [PATCHES] pg_autovacuum integration attempt #2

2004-07-12 Thread Andreas Pflug
Peter Eisentraut wrote: Bruce Momjian wrote: I have added this patch plus your later comments to the patch queue. The autovacuum process still uses libpq to send its queries, which is not the idea behind backend integration. Can we consider this a non-fatal bug that has to be solved soo

Re: [PATCHES] serverlog rotation/functions

2004-07-13 Thread Andreas Pflug
Bruce Momjian wrote: How is this patch supposed to work? Do people need to modify postgresql.conf and then sighup the postmaster? It seems more logical for the super-user to call a server-side function. I assume calling pg_logfile_rotate() to be the standard way. calling pg_logfile_rotate wil

Re: [PATCHES] serverlog rotation/functions

2004-07-13 Thread Andreas Pflug
Tom Lane wrote: That was something that bothered me too. I think in the patch as given, the GUC parameter determining the logfile name would have to be PGC_POSTMASTER, ie, you could not change it on the fly because the backends wouldn't all switch together. In my original posting it was PGC_POSTM

Re: [PATCHES] serverlog rotation/functions

2004-07-14 Thread Andreas Pflug
Tom Lane wrote: That struck me as not only useless but the deliberately hard way to do it. To use that in the real world, you'd have to set up a cron job to trigger the rotation, Still on my radar... which means a lot of infrastructure and privilege; whereas ISTM the point of this feature was to

Re: [PATCHES] serverlog rotation/functions

2004-07-14 Thread Andreas Pflug
Bruce Momjian wrote: Also there are no documenttion changes. Here are the missing docs, freshly created against cvs. Regards, Andreas Index: func.sgml === RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/func.sgml,v retrieving rev

[PATCHES] logfile subprocess and Fancy File Functions

2004-07-17 Thread Andreas Pflug
one is created (rotated). * The logfiles are stored in a subdirectory (configurable in * postgresql.conf), using an internal naming scheme that mangles * creation time and current postmaster pid. * * Author: Andreas Pflug <[EMAIL PROTECTED]> * * Copyright (c) 2004,

Re: [PATCHES] logfile subprocess and Fancy File Functions

2004-07-18 Thread Andreas Pflug
CTION_ARGS); +extern Datum pg_file_rename(PG_FUNCTION_ARGS); +extern Datum pg_file_unlink(PG_FUNCTION_ARGS); + +extern Datum pg_dir_ls(PG_FUNCTION_ARGS); + /* not_in.c */ extern Datum int4notin(PG_FUNCTION_ARGS); extern Datum oidnotin(PG_FUNCTION_ARGS); Index: src/include/utils/elog.h ==

Re: [PATCHES] logfile subprocess and Fancy File Functions

2004-07-19 Thread Andreas Pflug
Magnus Hagander wrote: > Super-minor nitpicking from just eyeing over the patch, not actually > checking how it works. Reviewing the own code the most obvious things are overlooked. > > This patch changes the error message for pg_signal_backend() to "only > superuser may access generic file functio

Re: [PATCHES] logfile subprocess and Fancy File Functions

2004-07-20 Thread Andreas Pflug
Bruce Momjian wrote: Andreas Pflug wrote: Very nice. You did a nice trick of reading the log filenames into a timestamp field: count = sscanf(de->d_name, "%04d-%02d-%02d_%02d%02d%02d_%05d.log", &yea$ You only process files that match that pattern for pg_logfiles_ls() (pe

Re: [PATCHES] logfile subprocess and Fancy File Functions

2004-07-20 Thread Andreas Pflug
Bruce Momjian wrote: Peter Eisentraut wrote: Bruce Momjian wrote: Peter Eisentraut wrote: Andreas Pflug wrote: How should the prefix be named? pgsql_ ? Make the file names configurable. He has code to interpret the file names as timestamps that can be used in queries. If we allowed full user

Re: [PATCHES] logfile subprocess and Fancy File Functions

2004-07-20 Thread Andreas Pflug
le configured * in postgresql.conf. If these limits are reached or passed, the * current logfile is closed and a new one is created (rotated). * The logfiles are stored in a subdirectory (configurable in * postgresql.conf), using an internal naming scheme that mangles * creation time and c

Re: [PATCHES] logfile subprocess and Fancy File Functions

2004-07-21 Thread Andreas Pflug
Bruce Momjian wrote: Andreas Pflug wrote: OK, new idea. Forget about modifying pg_dir_ls(). Instead add pg_file_stat the returns the file size, times. You can then easily use that for file size and times. Also, if you want, add an is_dir boolean so people can write functions that walk the

Re: [PATCHES] logfile subprocess and Fancy File Functions

2004-07-21 Thread Andreas Pflug
NCTION_ARGS); extern Datum pg_tablespace_databases(PG_FUNCTION_ARGS); +extern Datum pg_logfile_rotate(PG_FUNCTION_ARGS); +extern Datum pg_logdir_ls(PG_FUNCTION_ARGS); + +extern Datum pg_file_stat(PG_FUNCTION_ARGS); +extern Datum pg_file_read

Re: [PATCHES] logfile subprocess and Fancy File Functions

2004-07-22 Thread Andreas Pflug
Bruce Momjian wrote: Here is what you can do: SELECT filename, (SELECT file_len FROM pg_file_stat(filename)), (SELECT file_ctime FROM pg_file_stat(filename)), (SELECT file_mtime FROM pg_file_stat(filename)), (SELECT file_atime FROM pg_file_stat(filename)) FROM pg_dir_ls('/etc') AS

Re: [PATCHES] logfile subprocess and Fancy File Functions

2004-07-23 Thread Andreas Pflug
Bruce Momjian wrote: Are we done? Seems pg_file_stat() works fine. Do we need other adjustments? Here are the documentation changes. Regards, Andreas Index: catalogs.sgml === RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/ca

Re: [PATCHES] logfile subprocess and Fancy File Functions

2004-07-23 Thread Andreas Pflug
Tom Lane wrote: Bruce Momjian wrote: Are we done? Nope, the syslogger part of this is still a mess. I don't want any pg_logfile_rotate() function in there at all: its presence is a hangover from a different design philosophy. No. As I mentioned earlier, there might be cases when a superuser wants

Re: [PATCHES] [HACKERS] Function to kill backend

2004-07-25 Thread Andreas Pflug
Would you use a kill operation in the way you describe above if you knew that it had, say, a 1% chance of causing a database-wide PANIC each time you used it? Seems there's the need for some connection killing functionality. If it's not present, the whole cluster needs to be shut down, which mak

Re: [PATCHES] [HACKERS] Function to kill backend

2004-07-26 Thread Andreas Pflug
Tom Lane wrote: If you don't mind plastering a "use at your own risk" sign on it, then go for it. killing a backend is obviously much more "at your own risk" than a descent function. Taken from your mail, I understand that a killed backend might leave some loose ends, eg. open locks, which would

[PATCHES] logger subprocess

2004-07-27 Thread Andreas Pflug
This is the known patch, with following changes: - realStdErr handed over for EXEC_BACKEND, but still not tested - Sometimes EMFILE is received in the logger's process queue, when a backend ended after a SSL connection was interrupted. This is ignored now (previously it forced an exit(1) and rest

[PATCHES] Admin functions contrib

2004-07-27 Thread Andreas Pflug
gfile_rotate' LANGUAGE C STABLE STRICT; CREATE FUNCTION pg_logdir_ls() RETURNS setof record AS 'MODULE_PATHNAME', 'pg_logdir_ls' LANGUAGE C VOLATILE STRICT; CREATE VIEW pg_logdir_ls AS SELECT * FROM pg_logdir_ls() AS A (filetime

[PATCHES] ruleutils with pretty-print option

2003-06-29 Thread Andreas Pflug
The attached patches will add pg_get_ruledef(oid, int) pg_get_viewdef(text, int) pg_get_viewdef(oid, int) pg_get_indexdef(oid, int) pg_get_constraintdef(oid, int) pg_get_expr(text, oid, int) If the last parameter "pretty-print" is 0, these function will return the same result as

Re: [PATCHES] Patch for UUID datatype (beta)

2006-09-18 Thread Andreas Pflug
Gevik Babakhani wrote: > - new_guid() function is supported. This function is based on V4 random > uuid value. It generated 16 random bytes with uuid 'variant' and > 'version'. It is not guaranteed to produce unique values Isn't guaranteed uniqueness the very attribute that's expected? AFAIK ther

Re: [PATCHES] [HACKERS] For review: Server instrumentation patch

2005-08-01 Thread Andreas Pflug
Dave Page wrote: -Original Message- From: Bruce Momjian [mailto:[EMAIL PROTECTED] Sent: 01 August 2005 03:26 To: Dave Page Cc: PostgreSQL-patches Subject: Re: [HACKERS] For review: Server instrumentation patch Dave Page wrote: [Resent as the list seems to have rejected yesterday

Re: [PATCHES] [HACKERS] For review: Server instrumentation patch

2005-08-01 Thread Andreas Pflug
Dave Page wrote: pg_dir_ls isn't necessary for reading the logfiles; pg_logdir_ls will do this. Err, yes, sorry - that was a thinko. The list isn't complete. pgadmin uses these three functions for logfile tracking: - pg_logdir_ls to list logfiles - pg_file_length to check for changes

Re: [PATCHES] [HACKERS] For review: Server instrumentation patch

2005-08-11 Thread Andreas Pflug
Bruce Momjian wrote: Dave Page wrote: The only part I didn't like about the patch is the stat display: test=> select pg_file_stat('postgresql.conf'); pg_file_stat --

Re: [PATCHES] [HACKERS] For review: Server instrumentation patch

2005-08-12 Thread Andreas Pflug
Bruce Momjian wrote: I did not include pg_logdir_ls because that was basically pg_ls_dir with logic to decode the log file name and convert it to a timestamp. That seemed best done in the client. IMHO omitting pg_logdir_ls is a bad idea, because the function is intended to hide server inter

Re: [PATCHES] [HACKERS] For review: Server instrumentation patch

2005-08-12 Thread Andreas Pflug
Bruce Momjian wrote: BTW, it surprised me that one of the functions (don't remember which one) expected the log files to be named in a very specific fashion. So there's no flexibility for changing the log_prefix. Probably it's not so bad, but strange anyway. Is this for "security" reasons?

Re: [PATCHES] [HACKERS] For review: Server instrumentation patch

2005-08-12 Thread Andreas Pflug
Tom Lane wrote: Andreas Pflug <[EMAIL PROTECTED]> writes: So how would your query to display all all available _logfiles_ look like? I think it's perfectly reasonable to assume that all the files in the log directory are logfiles --- more so than assuming that the admin hasn'

Re: [PATCHES] [HACKERS] For review: Server instrumentation patch

2005-08-12 Thread Andreas Pflug
Bruce Momjian wrote: I don't assume people using psql will care about the current log files --- Hm. Probably because you think these users will have direct file access? Which in turn means they can edit *.conf directly too and don't need an interface for that either. it would be somethi

Re: [PATCHES] [HACKERS] For review: Server instrumentation patch

2005-08-12 Thread Andreas Pflug
Bruce Momjian wrote: I don't see how listing the log files relates to editing the confuration files. Both are remote administration. While we've seen the discussion that one aspect (config file editing) should be performed in psql, you assume the other aspect (viewing the logfile) to be no

Re: [PATCHES] [HACKERS] For review: Server instrumentation patch

2005-08-13 Thread Andreas Pflug
Bruce Momjian wrote: True, but that is more for the application. I don't imagine a user looking at that from psql would have a problem. However, you asked for a query that looks like pg_ls_logdir() and here it is: SELECT pg_ls_dir FROM( SEL

Re: [PATCHES] [HACKERS] For review: Server instrumentation patch

2005-08-13 Thread Andreas Pflug
Tom Lane wrote: Andreas Pflug <[EMAIL PROTECTED]> writes: Bruce Momjian wrote: Well, if they mix log files and non-log files in the same directory, we would have to filter based on the log_filename directive in the application, or use LIKE in a query. .. which is what pg_logdir_l

Re: [PATCHES] [HACKERS] For review: Server instrumentation patch

2005-08-13 Thread Andreas Pflug
Bruce Momjian wrote: Also, do we have a way to return columns from a system-installed function? I really don't like that pg_stat_file() to returns a record rather than named columns. How do I even access the individual record values? As in pg_settings: SELECT length, mtime FROM pg_file_stat

Re: [PATCHES] [HACKERS] For review: Server instrumentation patch

2005-08-14 Thread Andreas Pflug
Tom Lane wrote: I removed the separate pg_file_length() function, as it doesn't have any significant notational advantage anymore; you can do Please note that there are pg_file_length functions in use for 8.0 on probably >95 % of win32 installations, so you're breaking backwards compatibilit

  1   2   >