In ShmemAlloc() we have: newStart = BUFFERALIGN(newStart); newSpace = (void *) (ShmemBase + newStart); return newSpace;
Notice that though newStart is ALIGNOF_BUFFER, ShmemBase is not. Thus the newSpace is not aligned as we disired. Attached please find the patch. Regards, Qingqing Index: src/backend/storage/ipc/shmem.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v retrieving revision 1.92 diff -c -r1.92 shmem.c *** src/backend/storage/ipc/shmem.c 13 Jul 2006 16:49:16 -0000 1.92 --- src/backend/storage/ipc/shmem.c 14 Jul 2006 06:47:43 -0000 *************** *** 169,178 **** SpinLockAcquire(ShmemLock); newStart = shmemseghdr->freeoffset; /* extra alignment for large requests, since they are probably buffers */ if (size >= BLCKSZ) ! newStart = BUFFERALIGN(newStart); newFree = newStart + size; if (newFree <= shmemseghdr->totalsize) --- 169,179 ---- SpinLockAcquire(ShmemLock); newStart = shmemseghdr->freeoffset; + newSpace = (void *) MAKE_PTR(newStart); /* extra alignment for large requests, since they are probably buffers */ if (size >= BLCKSZ) ! newStart = MAKE_OFFSET(BUFFERALIGN(newSpace)); newFree = newStart + size; if (newFree <= shmemseghdr->totalsize) ---------------------------(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