On Tue, Apr 15, 2014 at 12:33 AM, Amit Kapila <amit.kapil...@gmail.com> wrote: > On Mon, Apr 14, 2014 at 10:03 PM, Robert Haas <robertmh...@gmail.com> wrote: >> On Sat, Apr 12, 2014 at 1:32 AM, Amit Kapila <amit.kapil...@gmail.com> wrote: >>> I have checked that other place in code also check handle to >>> decide if API has failed. Refer function PGSharedMemoryIsInUse(). >>> So I think fix to call GetLastError() after checking handle is okay. >>> Attached patch fixes this issue. After patch, the server shows below >>> log which is exactly what is expected from test_shm_mq >> >> In PostgreSQL code, hmap == NULL, rather than !hmap, is the preferred >> way to test for a NULL pointer. I notice that the !hmap style is used >> throughout this code, so I guess cleaning that up is a matter for a >> separate commit. > > I think in that case we might want to cleanup some other similar usage > (PGSharedMemoryCreate) of !hmap.
Ah. Well, in that case maybe we should just leave it alone, since it's been like that forever and nobody's cared until now. >> For the create case, I'm wondering if we should put the block that >> tests for !hmap *before* the _dosmaperr() and check for EEXIST. What >> is your opinion? > > Either way is okay, but I think the way you are suggesting is better as it > will make code consistent with other place (PGSharedMemoryCreate()). OK, can you prepare a patch? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers