Re: [GENERAL] Database Oid from SPI

2006-07-27 Thread Markus Schiltknecht
Hi, thank you both. I first tried that, but the segfault really irritated me. It's now working fine with miscadmin.h. Sorry for the noise. Regards Markus Tom Lane wrote: Actually I'd recommend you use the global MyDatabaseId from "miscadmin.h". It'll be the same value, but it's always best

Re: [GENERAL] Database Oid from SPI

2006-07-27 Thread Tom Lane
Markus Schiltknecht <[EMAIL PROTECTED]> writes: > Whoops, sorry, there was another reason for the segfault. Using > MyProc->databaseId works. Is it the right way to do it, though? Actually I'd recommend you use the global MyDatabaseId from "miscadmin.h". It'll be the same value, but it's always

Re: [GENERAL] Database Oid from SPI

2006-07-27 Thread Alvaro Herrera
Markus Schiltknecht wrote: > Whoops, sorry, there was another reason for the segfault. Using > MyProc->databaseId works. Is it the right way to do it, though? I'd use MyDatabaseId ... -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulti

Re: [GENERAL] Database Oid from SPI

2006-07-27 Thread Markus Schiltknecht
Whoops, sorry, there was another reason for the segfault. Using MyProc->databaseId works. Is it the right way to do it, though? Markus Schiltknecht wrote: Hi, how can I get the database name or OID of the current backend in a SPI function (in plain C)? I tried including storage/proc.h and acc

[GENERAL] Database Oid from SPI

2006-07-27 Thread Markus Schiltknecht
Hi, how can I get the database name or OID of the current backend in a SPI function (in plain C)? I tried including storage/proc.h and accessing MyProc->databaseId, but that leads to a segfault :-( (and seems like the wrong way to do it.) The SPI documentation didn't help. Thank you Marku