Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 6D31DB5DC4B for ; Tue, 31 May 2011 22:02:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 82005-05 for ; Wed, 1 Jun 2011 01:02:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [173.230.139.50]) by mail.postgresql.org (Postfix) with ESMTP id 2D922B5DC2F for ; Tue, 31 May 2011 22:02:06 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by www.postnewspapers.com.au (Postfix) with ESMTP id CB30D10D for ; Tue, 31 May 2011 21:02:05 -0400 (EDT) X-Virus-Scanned: amavisd-new at postnewspapers.com.au.com Received: from www.postnewspapers.com.au ([127.0.0.1]) by localhost (www.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id WBEfPfGuzRhz for ; Tue, 31 May 2011 21:02:05 -0400 (EDT) Received: from mail.postnewspapers.com.au (ppp171-128.static.internode.on.net [150.101.171.128]) by www.postnewspapers.com.au (Postfix) with ESMTP id 6DD762D for ; Tue, 31 May 2011 21:02:04 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 7C37DAECF2 for ; Wed, 1 Jun 2011 09:02:03 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bsIIeAEjeuVX for ; Wed, 1 Jun 2011 09:01:57 +0800 (WST) Received: from [10.1.1.3] (unknown [124.169.247.86]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id C0858AE3EF for ; Wed, 1 Jun 2011 09:01:57 +0800 (WST) Message-ID: <4DE58F83.60207@postnewspapers.com.au> Date: Wed, 01 Jun 2011 09:01:55 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: PG Hackers Subject: Re: [BUGS] BUG #6046: select current_date crashes postgres References: <201105311728.p4VHSRbR063675@wwwmaster.postgresql.org> In-Reply-To: <201105311728.p4VHSRbR063675@wwwmaster.postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201105/1668 X-Sequence-Number: 188702 On 1/06/2011 1:28 AM, Rikard Pavelic wrote: > > The following bug has been logged online: > > Bug reference: 6046 > Logged by: Rikard Pavelic > Email address: rikard.pavelic@zg.htnet.hr > PostgreSQL version: 9.1 beta 1 > Operating system: Windows 7 64bit > Description: select current_date crashes postgres > Details: > > select current_time > or select current_date > > results in postgres crash. OK. I created the 'crashdumps' directory, gave the 'postgres' account full control and re-tested. The resulting dump can be debugged in Visual Studio Express 2008 (not 2010 - they removed that feature - but you can use windbg) - and shows: > postgres.exe!datebsearch(const char * key=0x005ef004, const datetkn * base=0xffffffff, int nel=-1) Line 3579 C > postgres.exe!DecodeSpecial(int field=0, char * lowtoken=0x005ef004, int * val=0x005eee78) Line 2789 + 0x11 bytes C > postgres.exe!DecodeTimeOnly(char * * field=0x005eef3c, int * ftype=0x005eefa0, int nf=1, int * dtype=0x005eef0c, pg_tm * tm=0x005eef10, int * fsec=0x005eef08, int * tzp=0x005eef00) Line 1921 + 0xf bytes C > postgres.exe!timetz_in(FunctionCallInfoData * fcinfo=0x005ef060) Line 1864 + 0x2b bytes C > postgres.exe!InputFunctionCall(FmgrInfo * flinfo=0x01d122bc, char * str=0x01d14090, unsigned int typioparam=1266, int typmod=-1) Line 1909 + 0x3a bytes C > postgres.exe!ExecEvalCoerceViaIO(CoerceViaIOState * iostate=0x01d12290, ExprContext * econtext=0x01d12198, char * isNull=0x01d12470, ExprDoneCond * isDone=0x01d12508) Line 4064 + 0x10 bytes C > postgres.exe!ExecTargetList(List * targetlist=0x01d124f0, ExprContext * econtext=0x01d12198, unsigned int * values=0x01d12460, char * isnull=0x01d12470, ExprDoneCond * itemIsDone=0x01d12508, ExprDoneCond * isDone=0x005ef310) Line 5107 + 0x27 bytes C > postgres.exe!ExecProject(ProjectionInfo * projInfo=0x01d12480, ExprDoneCond * isDone=0x005ef310) Line 5324 + 0x18 bytes C > postgres.exe!ExecResult(ResultState * node=0x00000000) Line 157 C > postgres.exe!ExecProcNode(PlanState * node=0x01d12110) Line 367 + 0x6 bytes C > postgres.exe!ExecutePlan(EState * estate=0x00000000, PlanState * planstate=0x01d12110, CmdType operation=CMD_SELECT, char sendTuples='', long numberTuples=0, ScanDirection direction=NoMovementScanDirection, _DestReceiver * dest=0x01b1f800) Line 1386 + 0xa bytes C > postgres.exe!standard_ExecutorRun(QueryDesc * queryDesc=0x7ffd7000, ScanDirection direction=6223960, long count=2008331305) Line 318 + 0x15 bytes C > kernel32.dll!@BaseThreadInitThunk@12() + 0x12 bytes It looks like the issue is that an invalid pointer is passed for `base'. `base' is used to calculate `position' which is then dereferenced - and splat! I suspect - but haven't verified - that the reason `base' is shown as 0xffffffff rather than NULL is that the optimizer has done away with the 'position' variable, instead using the 'base' variable passed as a parameter. There isn't any 'position' variable in the local stack. The static global `timezonetktbl' in src\backend\utils\adt\datetime.c is NULL. The calling function passes 'timezonetktbl' as the 'base' argument of datebsearch(...). So I'd say that 0xffffffff is just an artifact of the optimizer's work, and `base' was really passed as NULL. So - for some reason the time zone tables aren't getting loaded, or InstallTimeZoneAbbrevs(...) isn't being called to activate them. Is anyone aware of any changes between 9.0 and 9.1beta that messed with time zone handling and loading? -- Craig Ringer Tech-related writing at http://soapyfrogs.blogspot.com/