[HACKERS] failed to compile a C++ SPI function

2000-10-01 Thread Louis-David Mitterrand

Just for fun I changed the extension of my SPI function and trigger
source file from .c to .C and tried to compile it:

 g++ -g -Wall -I /usr/include/postgresql -fPIC -pedantic-c -o bid_control.o 
bid_control.C
 In file included from /usr/include/postgresql/nodes/relation.h:18,
  from /usr/include/postgresql/executor/spi.h:18,
  from bid_control.h:31,
  from bid_control.C:21:
 /usr/include/postgresql/nodes/parsenodes.h:871: parse error before `typename'

It seems the "typename" word used in the following structure is a
reserved word in C++. (and is appears colored like a type in Vim)

 /*
  * ParamNo - specifies a parameter reference
  */
 typedef struct ParamNo
 {
 NodeTag type;
 int number; /* the number of the parameter */
 TypeName   *typename;   /* the typecast */
  ^
 List   *indirection;/* array references */
 } ParamNo;

Is it totally unreasonable try C++ in SPI programming?

Cheers,


-- 
Louis-David Mitterrand - [EMAIL PROTECTED] - http://www.apartia.org

Isn't vi that text editor with two modes... one that beeps and one
that corrupts your file?" -- Dan Jocabson, on comp.os.linux.advocacy



Re: [HACKERS] memory management suggestion

2000-10-01 Thread Karel Zak


On Fri, 29 Sep 2000, Bruce Momjian wrote:

 Where are we on this?
 
Create from this non-used residual space chunk and remove it into free 
chunk list. 


 This is really old story. I hope that Tom think of this and has it's 
in his care. A problem is that standard day of this planet has 
24 hours for all people (incl. Tom :-), right?

Karel




[HACKERS] What do I need to be able to compile the source in Win32

2000-10-01 Thread Jarmo Paavilainen

Hi,

The subject says it all.

I want to mess up the backend so...

Do I need lex or flex?
Do I need autoconf (does it even exist for Windows)?
Do I need Cygnus?
Do I need any other aditional packages?

Does it compile with VC6?
Does nmake do or do I need gnu make?

Or is it easier to play around with the source in Linux?
What do I need in Linux (Cygnus, lex, flex...)?

// Jarmo




[HACKERS] pg_dump, BLOBs and single-table dumps - RFC

2000-10-01 Thread Philip Warner


It recently came to my attention that, when dumping a single table and
using the --blobs option, pg_dump will dump all BLOBs (not just those
referenced by the table). Similarly, restoring a single table from a backup
will restore all the BLOBs.

This is (at least) non-intuitive. 

Unfortunately, the task of restoring a single table with BLOBs is actually
somewhat complex: the OIDs will change, and the table needs to be updated
(which is fine), but it is definitely not clear how to handle other tables
in the database (since the current implementation allows multiple
references to one blob, which is very non-standard). The simple solution of
only updating the OID fields in the restored table seems as unintuitive as
the current situation, and also likely to produce unexpected results.

Also, scanning through the backup file for BLOBs used in the table to be
restored will be slow, to say the least. It can be done in one pass by
building an indexed temporary table with all OID fields from the target
table, but it is definitely getting messy. Especially since Jan was talking
about a decent BLOB implementation RSN.

My inclination at this stage is to disallow --blobs when dumping or
restoring a single table, but I would be interested in hearing from anybody
with a better solution.



Philip Warner| __---_
Albatross Consulting Pty. Ltd.   |/   -  \
(A.B.N. 75 008 659 498)  |  /(@)   __---_
Tel: (+61) 0500 83 82 81 | _  \
Fax: (+61) 0500 83 82 82 | ___ |
Http://www.rhyme.com.au  |/   \|
 |----
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/



Re: [HACKERS] memory management suggestion

2000-10-01 Thread Tom Lane

Karel Zak [EMAIL PROTECTED] writes:
  This is really old story. I hope that Tom think of this and has it's 
 in his care. A problem is that standard day of this planet has 
 24 hours for all people (incl. Tom :-), right?

Yup.  I've got one more area to wrap up in the new-features business
(I really want to make UNION/INTERSECT/EXCEPT work with subqueries in
FROM) and then it's back to mopup on memory management etc.

Fortunately, since Vadim requested a postponement of the beta schedule,
there's still time ...

regards, tom lane



Re: [HACKERS] What do I need to be able to compile the source in Win32

2000-10-01 Thread Tom Lane

"Jarmo Paavilainen" [EMAIL PROTECTED] writes:
 Or is it easier to play around with the source in Linux?

Yes.  You could maybe do it in a Cygwin environment, but I think
it'd be an exercise in frustration.

 What do I need in Linux (Cygnus, lex, flex...)?

As long as you install development tools (compilers etc) you'll
probably have all you need.

regards, tom lane



Re: [HACKERS] Solution for RI permission problem

2000-10-01 Thread Peter Eisentraut

Stephan Szabo writes:

 With that, I do have a general question though. Are referential actions
 supposed to be limited by the permissions of the user executing the query?
 So, if you for example have write access on the pk table, but not to the
 fk table, and there is a on cascade delete relationship, should that user
 not be able to delete from the pk table?

Then you could delete records that are not in relation to the foreign keys
in your table.  So I suppose not.  Of course there does seem to be a very
limited range of usefulness of such a setup, but we shouldn't extrapolate
something potentially more useful from that.


-- 
Peter Eisentraut  [EMAIL PROTECTED]   http://yi.org/peter-e/




[HACKERS] Re: Unruly rules

2000-10-01 Thread Tom Lane

Peter Eisentraut [EMAIL PROTECTED] writes:
 The backend process hangs in this loop:

 | foreach(temp, rangetable)

 Somewhere a list pointer needs to be advanced there.

What?  foreach() does advance the pointer.  The only way this can be
an infinite loop is if the rangetable list is circular.

I wouldn't rank that as out of the question, considering the enthusiasm
with which the rules code munges range lists, but I still don't see it
happening here.  Is anyone else seeing regression failures with current
sources?

regards, tom lane



[HACKERS] pg_log deleted, still help needed (2)

2000-10-01 Thread Ralf Tschiersch

Sorry,

Postgres is 6.5.3 on Linux 2.2.10

Ralf





Re: [HACKERS] Re: ODBC patch

2000-10-01 Thread Bruce Momjian

Can I ask about the status of this?

I modified the current ODBC driver for
* referential integrity error reporting,
* SELECT in transactions and
* disabling autocommit.
   We are starting to think about organizing additional ODBC testing 
  Yes, sure. I know that this code (which was sent to Thomas) needs 
  further check. Have you had time to think about it?
 
 Sorry to ask this: can you please re-re-send the patch to me? I've
 upgraded my machine and at the moment my backup disk is unreadable :(
 
 re-TIA
 
  - Thomas
 


-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [HACKERS] PgAccess - small bug?

2000-10-01 Thread Bruce Momjian

Constantin, can you comment on this?

 
 
 
 
 On Wed, 31 May 2000, Bruce Momjian wrote:
 
  I assume this is fixed?
 
  Oh, it is really old letter from me. I total forget... 
 
  Hmm, I haven't here last version of CVS, but pgaccess in my comp has this
 bug still..
 
  Bruce, thanks for answer. I not had hope that anyone advert to this.
 
   Karel
 
  
   
   Hi,
   
   in PgAccess's the create table dialog is small bug. If I define a new table
   as interits of other table and I not define any column (as 'field' named this 
   dialog) - PgAccess return ERROR message "Your table has not field!". But
   PgSQL allow define table as:
   
 CREATE TABLE xxx () INHERITS(yyy); 
   
   ...all colunms is from 'yyy'. 
   
   NOTE: Why a attribute (column) is in the PgAccsess named 'field'? It is 
   abnormal in SQL speech... 
   
 Karel
   
   --
   Karel Zak [EMAIL PROTECTED]  http://home.zf.jcu.cz/~zakkr/
   
   Docs: http://docs.linux.cz  (big docs archive)   
 
   Kim Project:  http://home.zf.jcu.cz/~zakkr/kim/  (process manager)
   FTP:  ftp://ftp2.zf.jcu.cz/users/zakkr/  (C/ncurses/PgSQL)
   --
   
   
   
   
  
  
  -- 
Bruce Momjian|  http://www.op.net/~candle
[EMAIL PROTECTED]   |  (610) 853-3000
+  If your life is a hard drive, |  830 Blythe Avenue
+  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026
  
 
 


-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [HACKERS] Strange error message

2000-10-01 Thread Adriaan Joubert

Tom Lane wrote:

 Adriaan Joubert [EMAIL PROTECTED] writes:
  we've suddenly started getting this error message out of postgres
  (7.0.2). Does anybody know where it comes from?

  ERROR:  UNLockBuffer: buffer 0 is not locked

 Evidently something is passing an invalid buffer number to LockBuffer
 in src/backend/storage/buffer/bufmgr.c.  (0 is InvalidBuffer, but
 LockBuffer won't notice that unless you compiled with asserts enabled.)
 Whatever the bug is, it's not directly LockBuffer's fault.

Right, I'vebuilt a new database and everything seemed fine for a while and
now I've got this message back. It is due to the index on one of our
tables getting messed up - at least, if we drop and recreate the index
everything is fine. What should I do to track down what is happening?
Compile with asserts, or run with specific logging? Any advice
appreciated!

Adriaan