Re: [PATCHES] Win32 gettimeofday() comment patch

2005-12-17 Thread Bruce Momjian

Patch applied.  Thanks.

---


Qingqing Zhou wrote:
 
 Add a note to Win32 gettimeofday() emulation.
 
 Regards,
 Qingqing
 
 ---
 
 Index: gettimeofday.c
 ===
 RCS file: /projects/cvsroot/pgsql/src/port/gettimeofday.c,v
 retrieving revision 1.6
 diff -c -r1.6 gettimeofday.c
 *** gettimeofday.c  16 May 2005 05:52:13 -  1.6
 --- gettimeofday.c  16 Dec 2005 19:37:41 -
 ***
 *** 36,41 
 --- 36,43 
 
   /*
* timezone information is stored outside the kernel so tzp isn't used 
 anymore.
 +  * Note: this function is not for Win32 high precision timing purpose, see
 +  * elapsed_time() etc.
*/
   int
   gettimeofday(struct timeval * tp, struct timezone * tzp)
 
 
 ---(end of broadcast)---
 TIP 3: Have you checked our extensive FAQ?
 
http://www.postgresql.org/docs/faq
 

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [PATCHES] Win32 gettimeofday() comment patch

2005-12-17 Thread Bruce Momjian
Bruce Momjian wrote:
 
 Patch applied.  Thanks.

By Alvaro.  ;-)

 ---
 
 
 Qingqing Zhou wrote:
  
  Add a note to Win32 gettimeofday() emulation.
  
  Regards,
  Qingqing
  
  ---
  
  Index: gettimeofday.c
  ===
  RCS file: /projects/cvsroot/pgsql/src/port/gettimeofday.c,v
  retrieving revision 1.6
  diff -c -r1.6 gettimeofday.c
  *** gettimeofday.c  16 May 2005 05:52:13 -  1.6
  --- gettimeofday.c  16 Dec 2005 19:37:41 -
  ***
  *** 36,41 
  --- 36,43 
  
/*
 * timezone information is stored outside the kernel so tzp isn't used 
  anymore.
  +  * Note: this function is not for Win32 high precision timing purpose, see
  +  * elapsed_time() etc.
 */
int
gettimeofday(struct timeval * tp, struct timezone * tzp)
  
  
  ---(end of broadcast)---
  TIP 3: Have you checked our extensive FAQ?
  
 http://www.postgresql.org/docs/faq
  
 
 -- 
   Bruce Momjian|  http://candle.pha.pa.us
   pgman@candle.pha.pa.us   |  (610) 359-1001
   +  If your life is a hard drive, |  13 Roberts Road
   +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073
 
 ---(end of broadcast)---
 TIP 3: Have you checked our extensive FAQ?
 
http://www.postgresql.org/docs/faq
 

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [PATCHES] TODO Item - Add system view to show free space map

2005-12-17 Thread Bruce Momjian

Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---


Mark Kirkwood wrote:
 Mark Kirkwood wrote:
  Bruce Momjian wrote:
  
  Mark Kirkwood wrote:
 
  Simon Riggs wrote:
 
 
  I like this, but not because I want to read it myself, but because I
  want to make autovacuum responsible for re-allocating free space 
  when it
  runs out. This way we can have an autoFSM feature in 8.2
 
 
 
  Not wanting to denigrate value of the interesting but slightly OT 
  direction this thread has taken - but does anybody want to 
  comment/review the patch itself :-) ?
 
 
 
  I saw this question about a transaction block and your reply:
 
  http://archives.postgresql.org/pgsql-patches/2005-10/msg00226.php
 
  but no new patch.  I know someone suggested pgfoundry but it seems most
  natural in /contrib.  Do you want to update the patch?
 
  
  In the expectation of further revisions, I was going to batch that one 
  in with the 'rest' - given that there have not been any, I'll submit a 
  revised patch.
  
 
 Here it is - I seem to have had trouble sending any attachments to this 
 list recently. Bruce the patch (sent privately), so its in the patches 
 queue, but thought I would have another go at getting it to -patches so 
 others can review it more easily!
 
 cheers
 
 Mark

[ application/gzip is not supported, skipping... ]

 
 ---(end of broadcast)---
 TIP 3: Have you checked our extensive FAQ?
 
http://www.postgresql.org/docs/faq

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [PATCHES] Single-Transaction Utility options

2005-12-17 Thread Simon Riggs
On Fri, 2005-12-16 at 15:56 -0500, Tom Lane wrote:
 Simon Riggs [EMAIL PROTECTED] writes:
  On Fri, 2005-12-16 at 13:59 -0500, Tom Lane wrote:
  Would -1 work, or just confuse people?
 
  That was my preference, I just thought it wouldn't be popular...
  So I'll happily change that.
 
 OK.  While you're at it, I didn't like the long name either ;-).
 We do not use the abbrevation txn anywhere, so I think it's bad to
 introduce it here.  I'd vote for spelling out --single-transaction,
 or maybe just --single.  I believe you can abbreviate long switch names
 to any unique prefix, so there's not really any more typing here.

Changes as discussed. singletransaction.patch attached.

options:
-1 or --single-transaction

Functions work as described.

Best Regards, Simon Riggs
Index: src/bin/pg_dump/pg_backup.h
===
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v
retrieving revision 1.37
diff -c -r1.37 pg_backup.h
*** src/bin/pg_dump/pg_backup.h	15 Oct 2005 02:49:38 -	1.37
--- src/bin/pg_dump/pg_backup.h	17 Dec 2005 16:51:25 -
***
*** 115,120 
--- 115,122 
  
  	int			suppressDumpWarnings;	/* Suppress output of WARNING entries
  		 * to stderr */
+ boolsingle_txn;
+ 
  } RestoreOptions;
  
  /*
Index: src/bin/pg_dump/pg_backup_archiver.c
===
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.118
diff -c -r1.118 pg_backup_archiver.c
*** src/bin/pg_dump/pg_backup_archiver.c	22 Nov 2005 18:17:28 -	1.118
--- src/bin/pg_dump/pg_backup_archiver.c	17 Dec 2005 16:51:27 -
***
*** 217,222 
--- 217,225 
  
  	AH-stage = STAGE_PROCESSING;
  
+ if (ropt-single_txn)
+ 		ahprintf(AH, BEGIN;\n\n);
+ 
  	/*
  	 * Drop the items at the start, in reverse order
  	 */
***
*** 365,370 
--- 368,376 
  		}
  	}
  
+ if (ropt-single_txn)
+ 		ahprintf(AH, COMMIT;\n\n);
+ 
  	if (AH-public.verbose)
  		dumpTimestamp(AH, Completed on, time(NULL));
  
Index: src/bin/pg_dump/pg_restore.c
===
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v
retrieving revision 1.73
diff -c -r1.73 pg_restore.c
*** src/bin/pg_dump/pg_restore.c	15 Oct 2005 02:49:39 -	1.73
--- src/bin/pg_dump/pg_restore.c	17 Dec 2005 16:51:27 -
***
*** 111,116 
--- 111,117 
  		{use-list, 1, NULL, 'L'},
  		{username, 1, NULL, 'U'},
  		{verbose, 0, NULL, 'v'},
+ 		{single-transaction, 0, NULL, '1'},
  
  		/*
  		 * the following options don't have an equivalent short option letter,
***
*** 142,148 
  		}
  	}
  
! 	while ((c = getopt_long(argc, argv, acCd:ef:F:h:iI:lL:n:Op:P:RsS:t:T:uU:vWxX:,
  			cmdopts, NULL)) != -1)
  	{
  		switch (c)
--- 143,149 
  		}
  	}
  
! 	while ((c = getopt_long(argc, argv, acCd:ef:F:h:iI:lL:n:Op:P:RsS:t:T:uU:vWxX:1,
  			cmdopts, NULL)) != -1)
  	{
  		switch (c)
***
*** 185,193 
--- 186,200 
  opts-tocFile = strdup(optarg);
  break;
  
+ 			case 'n':			/* Dump data for this schema only */
+ opts-selTypes = 1;
+ opts-schemaNames = strdup(optarg);
+ break;
+ 
  			case 'O':
  opts-noOwner = 1;
  break;
+ 
  			case 'p':
  if (strlen(optarg) != 0)
  	opts-pgport = strdup(optarg);
***
*** 223,233 
  opts-tableNames = strdup(optarg);
  break;
  
- 			case 'n':			/* Dump data for this schema only */
- opts-selTypes = 1;
- opts-schemaNames = strdup(optarg);
- break;
- 
  			case 'u':
  opts-requirePassword = true;
  opts-username = simple_prompt(User name: , 100, true);
--- 230,235 
***
*** 268,273 
--- 270,280 
  			case 0:
  break;
  
+ 			case '1':			/* Restore data in a single transaction */
+ opts-single_txn = true;
+ opts-exit_on_error = true;
+ break;
+ 
  			default:
  fprintf(stderr, _(Try \%s --help\ for more information.\n), progname);
  exit(1);
***
*** 394,399 
--- 401,407 
  	printf(_(  -X use-set-session-authorization, --use-set-session-authorization\n
  			use SESSION AUTHORIZATION commands instead of\n
  			OWNER TO commands\n));
+ 	printf(_(  -1, --single-transaction restore as a single transaction\n));
  
  	printf(_(\nConnection options:\n));
  	printf(_(  -h, --host=HOSTNAME  database server host or socket directory\n));
Index: src/bin/psql/command.c
===
RCS file: /projects/cvsroot/pgsql/src/bin/psql/command.c,v
retrieving revision 1.155
diff -c -r1.155 command.c
*** src/bin/psql/command.c	8 Dec 2005 21:18:22 -	1.155
--- src/bin/psql/command.c	17 Dec 2005 16:51:29 -
***
*** 523,529 
  		else
  		{
  			

Re: [PATCHES] Single-Transaction Utility options

2005-12-17 Thread Peter Eisentraut
Simon Riggs wrote:
 Changes as discussed. singletransaction.patch attached.

I meant to ask, why is this not the default or only behavior?  Your 
patch does not contain a documentation update, and so the user has no 
information about why to use this option or not.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [PATCHES] [BUGS] Solaris cc compiler on amd: PostgreSQL does not have native

2005-12-17 Thread Bruce Momjian
Pierre Girard wrote:
 Tom Lane wrote:
 
 You'd need to do something about adapting src/backend/port/tas/solaris_i386.s
 
 It's possible that the assembly code would work as-is on amd, in which
 case you'd just need a one-liner change in s_lock.h and maybe some
 adjustment of the template file.
   
 
 It doesn't compile with the options to create amd code.
 cc -Xa -xtarget=opteron -xarch=amd64 -c solaris_i386.s
 Assembler: tas.s
 solaris_i386.s, line 12 : Illegal mnemonic
 solaris_i386.s, line 14 : Illegal mnemonic
 solaris_i386.s, line 15 : Syntax error
 solaris_i386.s, line 17 : Syntax error
 solaris_i386.s, line 26 : Illegal mnemonic
 solaris_i386.s, line 28 : Illegal mnemonic
 cc: assembler failed for solaris_i386.s
 
 The same file compiles without those options:
 cc -Xa -c solaris_i386.s

Interesting.  Seems you have a setup that uses its own assembly source
file in port/tas/solaris_i386.s, rather than using inline C ASM.  There
are files for both Sparc and i386 there, and are both used only for the
Sun compiler.  Does the Sun compiler not support ASM inlining?  

Looking at the error line, it is:

pushl   %ebp/save prev base pointer

and then:

pushl   %ebx/save prev bx

Looks like it is all documented here:

http://www.x86-64.org/documentation/assembly

Specifically:

Exceptions from this rule are instructions manipulating the stack (push,
pop, call, ret, enter and leave) which are implicitly 64-bit and their
32-bit counterparts are not available anymore, yet their 16-bit
counterparts are. So:

  pushl %eax# Illegal instruction
  pushq %rax# 1 byte instruction encoded as pushl %eax in 
32 bits
  pushq %r10# 2 byte instruction encoded as pushl preceeded 
by REX.

Looking before that, the 64-bit registers are now prefixed with 'r'
instead of 'e', so what I did was to convert all the long/l assembler
instructions to quad/64-bit/q, and rename the registers to use 64-bit
versions. I also modified the function alignment from 4 to 8, patch
attached.  Please give it a try and report back any error lines.

Seems Sun might be interested in geting this working.  We don't have an
official Sun contact yet for this project.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073
Index: src/backend/port/tas/solaris_i386.s
===
RCS file: /cvsroot/pgsql/src/backend/port/tas/solaris_i386.s,v
retrieving revision 1.2
diff -c -c -r1.2 solaris_i386.s
*** src/backend/port/tas/solaris_i386.s 19 Jun 1998 02:55:09 -  1.2
--- src/backend/port/tas/solaris_i386.s 17 Dec 2005 20:57:07 -
***
*** 9,33 
  
  .globl  tas
  tas:
! pushl   %ebp/save prev base pointer
! movl%esp,%ebp   /new base pointer
! pushl   %ebx/save prev bx
! movl8(%ebp),%ebx/load bx with address of lock
! movl$255,%eax   /put something in ax
! xchgb   %al,(%ebx)  /swap lock value with 0
  cmpb$0,%al  /did we get the lock?
  jne .Locked
! subl%eax,%eax   /yes, we got it -- return 0
  jmp .Finish
! .align  4
  .Locked:
! movl$1,%eax /no, we didn't get it - return 1
  .Finish:
! popl%ebx/restore prev bx
! movl%ebp,%esp   /restore stack state
! popl%ebp
  ret /return
! .align  4
  .type   tas,@function
  .size   tas,.-tas
  
--- 9,33 
  
  .globl  tas
  tas:
! pushq   %rbp/save prev base pointer
! movq%rsp,%rbp   /new base pointer
! pushq   %rbx/save prev bx
! movq8(%rbp),%rbx/load bx with address of lock
! movq$255,%rax   /put something in ax
! xchgb   %al,(%rbx)  /swap lock value with 0
  cmpb$0,%al  /did we get the lock?
  jne .Locked
! subq%rax,%rax   /yes, we got it -- return 0
  jmp .Finish
! .align  8
  .Locked:
! movq$1,%rax /no, we didn't get it - return 1
  .Finish:
! popq%rbx/restore prev bx
! movq%rbp,%rsp   /restore stack state
! popq%rbp
  ret /return
! .align  8
  .type   tas,@function
  .size   tas,.-tas
  

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command 

Re: [PATCHES] [BUGS] Solaris cc compiler on amd: PostgreSQL does not have native

2005-12-17 Thread Tom Lane
Bruce Momjian pgman@candle.pha.pa.us writes:
 Looking before that, the 64-bit registers are now prefixed with 'r'
 instead of 'e', so what I did was to convert all the long/l assembler
 instructions to quad/64-bit/q, and rename the registers to use 64-bit
 versions. I also modified the function alignment from 4 to 8, patch
 attached.  Please give it a try and report back any error lines.

Surely that breaks it for the i386 case --- don't we need a separate
solaris_x86_64.s source file?

regards, tom lane

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [PATCHES] [BUGS] Solaris cc compiler on amd: PostgreSQL does not

2005-12-17 Thread Bruce Momjian
Tom Lane wrote:
 Bruce Momjian pgman@candle.pha.pa.us writes:
  Looking before that, the 64-bit registers are now prefixed with 'r'
  instead of 'e', so what I did was to convert all the long/l assembler
  instructions to quad/64-bit/q, and rename the registers to use 64-bit
  versions. I also modified the function alignment from 4 to 8, patch
  attached.  Please give it a try and report back any error lines.
 
 Surely that breaks it for the i386 case --- don't we need a separate
 solaris_x86_64.s source file?

Yes, it is only for him to test.  But his email bounced back so it is
possible he isn't going to be back.  :-(

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster