[GENERAL] Re: [HACKERS] pg_dump blobs - editable dump?

2000-07-12 Thread Philip Warner

At 10:13 12/07/00 -0400, Lamar Owen wrote:
Philip Warner wrote:
 My guess is that this will involve a plain text schema dump, followed by
 all BLOBs in separate files, and a script to load them. To implement this
 I'll obviosly need to be passed a directory/file location for the script
 since I can't pipe seperate files to stdout.

uuencode the blobs, perhaps, using a shar-like format?

For the human readable version, the request was to make it editable and
sendable to psql. As a result the BLOBs need to be in their binary format
OR psql needs to support BLOB import from stdin. As a first pass I was
hoping for the simple 'dump them into files' solution.

What I am confused by is what people actually want to do with a load of
BLOBs sitting in a directory; if there are specific needs, then I'd also
like to cater for them in the custom file formats.



Philip Warner| __---_
Albatross Consulting Pty. Ltd.   |/   -  \
(A.C.N. 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: [GENERAL] RE: [HACKERS] pg_dump blobs - editable dump?

2000-07-12 Thread Peter Mount

No he didn't, just I've been sort of lurking on this subject ;-)

Actually, tar files are simply a small header, followed by the file's
contents. To add another file, you simply write another header, and contents
(which is why you can cat two tar files together and get a working file).

http://www.goice.co.jp/member/mo/formats/tar.html has a nice brief
description of the header.

As for a C api with a compatible licence, if needs must I'll write one to
your spec (maidast should be back online in a couple of days, so I'll be
back in business development wise).

Peter

--
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council


-Original Message-
From: Philip Warner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 12, 2000 3:17 PM
To: Peter Mount; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [GENERAL] RE: [HACKERS] pg_dump  blobs - editable dump?


At 14:58 12/07/00 +0100, Peter Mount wrote:
Why not have it using something like tar, and the first file being stored
in
ascii?

That way, you could extract easily the human readable SQL but still pipe
the
blobs to stdout.

Has Tom Lane paid you to send this message? :-}

If anyone can send me a nice interface for reading and writing a tar file
from C, I'll do it. I just don't have the inclination to learn about tar
internals at the moment. By 'nice' I mean that I would like:

- to be able to create the archive and write files sequentially using
something similar to fopen/fwrite/fclose.

- open an archive and examine and read files sequentially using a similar
interface to opendir/readdir/fopen/fread/fclose.

- Ideally open a specified file in the archive by name, but if not
possible, then it should be easy using the 'opedir' function above.

This would be a very useful library, I am sure. It also needs to be
licensable under BSD to go into the PG distribution.



Philip Warner| __---_
Albatross Consulting Pty. Ltd.   |/   -  \
(A.C.N. 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: [GENERAL] RE: [HACKERS] pg_dump blobs - editable dump?

2000-07-12 Thread Jim Mercer

On Thu, Jul 13, 2000 at 12:17:28AM +1000, Philip Warner wrote:
 At 14:58 12/07/00 +0100, Peter Mount wrote:
 Why not have it using something like tar, and the first file being stored in
 ascii?
 
 That way, you could extract easily the human readable SQL but still pipe the
 blobs to stdout.
 
 If anyone can send me a nice interface for reading and writing a tar file
 from C, I'll do it. I just don't have the inclination to learn about tar
 internals at the moment. By 'nice' I mean that I would like:

i suspect you might find a library of either tar or cpio read functions as
part of the FreeBSD sysinstall utility.

-- 
[ Jim Mercer [EMAIL PROTECTED]  +1 416 410-5633 ]
[  Reptilian Research -- Longer Life through Colder Blood  ]
[  Don't be fooled by cheap Finnish imitations; BSD is the One True Code.  ]



[GENERAL] RE: [HACKERS] pg_dump blobs - editable dump?

2000-07-12 Thread Peter Mount

Which is why having them on stdout is still a nice option to have. You can
pipe the lot through your favourite compressor (gzip, bzip2 etc) and
straight on to tape, or whatever.

I don't know why you would want them as separate files - just think what
would happen to directory search times!!

How about this as an idea:
* Option to dump sql to stdout and blobs to a designated file
* option to dump sql  blobs to stdout
* option to dump just sql to stdout
* option to dump just blobs to stdout

That way (depending on the database design), you could handle the sql 
blobs separately but still have everything backed up.

PS: Backups is formost on my mind at the moment - had an NT one blow up in
my face on Monday and it wasn't nice :-(

Peter

--
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council


-Original Message-
From: Philip Warner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 12, 2000 3:22 PM
To: Lamar Owen
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: [HACKERS] pg_dump  blobs - editable dump?


At 10:13 12/07/00 -0400, Lamar Owen wrote:
Philip Warner wrote:
 My guess is that this will involve a plain text schema dump, followed by
 all BLOBs in separate files, and a script to load them. To implement this
 I'll obviosly need to be passed a directory/file location for the script
 since I can't pipe seperate files to stdout.

uuencode the blobs, perhaps, using a shar-like format?

For the human readable version, the request was to make it editable and
sendable to psql. As a result the BLOBs need to be in their binary format
OR psql needs to support BLOB import from stdin. As a first pass I was
hoping for the simple 'dump them into files' solution.

What I am confused by is what people actually want to do with a load of
BLOBs sitting in a directory; if there are specific needs, then I'd also
like to cater for them in the custom file formats.



Philip Warner| __---_
Albatross Consulting Pty. Ltd.   |/   -  \
(A.C.N. 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   |/



[GENERAL] Re: [HACKERS] pg_dump blobs - editable dump?

2000-07-12 Thread Lamar Owen

Philip Warner wrote:
 At 10:13 12/07/00 -0400, Lamar Owen wrote:
 Philip Warner wrote:
  I'll obviosly need to be passed a directory/file location for the script
  since I can't pipe seperate files to stdout.
 
 uuencode the blobs, perhaps, using a shar-like format?
 
 For the human readable version, the request was to make it editable and
 sendable to psql. As a result the BLOBs need to be in their binary format
 OR psql needs to support BLOB import from stdin. As a first pass I was
 hoping for the simple 'dump them into files' solution.

If in a shell archive format, shouldn't it be easy enough for pg_restore
to be made to do the stdin-to-blob thing (through whatever mechanisms
you're already using to get the blob back in in the first place,
combined with some steering/deshar-ing/uudecoding logic)?  The backup
could even be made 'self-extracting' as shars usually are... :-) Of
course, you then have to be on the watch for the usual shar trojans...

If we simply know that the backup cannot be sent to psql, but a
deshar-ed version can have the schema sent to psql, would that
ameliorate most concerns?

--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11



[GENERAL] RE: [HACKERS] pg_dump blobs - editable dump?

2000-07-12 Thread Philip Warner

At 15:32 12/07/00 +0100, Peter Mount wrote:
Which is why having them on stdout is still a nice option to have. You can
pipe the lot through your favourite compressor (gzip, bzip2 etc) and
straight on to tape, or whatever.

Well, the custom format does that, it also does compression and can go to
stdout. 


I don't know why you would want them as separate files - just think what
would happen to directory search times!!

I agree; the request was based on a desire to do something like pg_dump_lo,
which puts them all in a directory, I think.


How about this as an idea:
   * Option to dump sql to stdout and blobs to a designated file
   * option to dump sql  blobs to stdout
   * option to dump just sql to stdout
   * option to dump just blobs to stdout


The sql is *tiny* compared to most BLOB contents. The new pg_dump currently
supports:

   * schema, table data,  blobs
   * schema, table data
   * schema
   * table data  blobs
   * table data

BLOBS without table data are not recomended since the process of relinking
the BLOBs to the tables is *only* performed on tables that are restored.
This is to allow import of BLOBS  tables into existing DBs. As a result
your fourth option is not really an option. The other three are already
covered.

Any single-file format (tar would be one of those) can be sent to stdout,
and BLOBs are not supported in plain-text output (for obvious reasons).


That way (depending on the database design), you could handle the sql 
blobs separately but still have everything backed up.

Unfortunately the data and BLOBS need to go together.


PS: Backups is formost on my mind at the moment - had an NT one blow up in
my face on Monday and it wasn't nice :-(

With the current version you should be able to do:

pg_dump -Fc --blobs | /dev/myfavoritetapedrive

to backup the entire database, with compressed data, to tape.

And 

cat /dev/mt | pg_restore --db=dbname

to restore the entire db into the specified database

Or,

pg_dump -Fc --blobs | pg_restore --db=dbname

to copy a database with blobs...

So, in summary, I think most of what you want is already there. It's just
the human-readable part that's a problem.

*Please* let me know if there is some issue I have not considered...



Philip Warner| __---_
Albatross Consulting Pty. Ltd.   |/   -  \
(A.C.N. 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: [GENERAL] RE: [HACKERS] pg_dump blobs - editable dump?

2000-07-12 Thread Brook Milligan

   If anyone can send me a nice interface for reading and writing a tar file
   from C, I'll do it. I just don't have the inclination to learn about tar
   internals at the moment. By 'nice' I mean that I would like:

I don't know the details of the API, but the NetBSD pax code handles
tar formats (and others) nicely and on a cursory glance seems to have
what you need.  Of course, the license is acceptable.  If you want the
source, let me know.

Cheers,
Brook



Re: [GENERAL] Retrieving INTERVAL as float hours?

2000-07-12 Thread Alex Bolenok

- Original Message - 
From: "Ken Causey" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 12, 2000 6:14 PM
Subject: [GENERAL] Retrieving INTERVAL as float hours?


 This may be a stupid question, and feel free to RTFM me, but please
 specify the manual/book as I can't seem to find this.  I want
 to retrieve an INTERVAL (the sum of INTERVALS actually) as a float
 hour.  In other words if I normally get an output like
 
 @ 2 hours 30 minutes
 
 I would like
 
 2.5
 
 Thanks in advance for all help.
 
 Ken Causey
 


ikar=# SELECT DATE_PART('epoch', '2 hours 30 minutes'::interval) / 3600;
 ?column?
--
  2.5
(1 row)

Alex Bolenok




RE: [GENERAL] RE: [HACKERS] pg_dump blobs - editable dump?

2000-07-12 Thread Philip Warner

At 15:25 12/07/00 +0100, Peter Mount wrote:
No he didn't, just I've been sort of lurking on this subject ;-)

Actually, tar files are simply a small header, followed by the file's
contents. To add another file, you simply write another header, and contents
(which is why you can cat two tar files together and get a working file).

http://www.goice.co.jp/member/mo/formats/tar.html has a nice brief
description of the header.


Damn! I knew someone would call my bluff.

As you say, it looks remarkably simple.

A couple of questions:


136 12 bytes  Modify time (in octal ascii)

...do you know the format of the date (seconds since 1970?).


157100 bytes  Linkname ('\0' terminated, 99 maxmum length)

...what's this? Is it the target for symlinks?


329  8 bytes  Major device ID (in octal ascii)
337  8 bytes  Minor device ID (in octal ascii)345167 bytes
Padding

...and what should I set these to?

As for a C api with a compatible licence, if needs must I'll write one to
your spec (maidast should be back online in a couple of days, so I'll be
back in business development wise).

If you're serious about the offer, I'd be happy. But, given how simple the
format is, I can probably tack in into place myself. 

There is a minor problem. Currently I compress the output stream as I
receive it from PG, and send it to the archive. I don't know how big it
will be until it is written. The custom output format can handle this, but
in streaming a tar file to tape, I have to know the file size first. This
means writing to /tmp. I supose that's OK, but I've been trying to avoid it.



Philip Warner| __---_
Albatross Consulting Pty. Ltd.   |/   -  \
(A.C.N. 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   |/



[GENERAL] Re: [HACKERS] pg_dump blobs - editable dump?

2000-07-12 Thread Philip Warner

At 10:38 12/07/00 -0400, Lamar Owen wrote:

If we simply know that the backup cannot be sent to psql, but a
deshar-ed version can have the schema sent to psql, would that
ameliorate most concerns?


In the current version

pg_restore --schema

will send the schema to stdout

Is that sufficient? Or are you strictly interested in the text output side
of things?



 

Philip Warner| __---_
Albatross Consulting Pty. Ltd.   |/   -  \
(A.C.N. 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   |/



[GENERAL] Re: [HACKERS] pg_dump blobs - editable dump?

2000-07-12 Thread Lamar Owen

Philip Warner wrote:
 will send the schema to stdout
 
 Is that sufficient? Or are you strictly interested in the text output side
 of things?

Strictly interested in the text output side of things, for various
not-necessarily-good reasons (:-)).

--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11



[GENERAL] listen/notify

2000-07-12 Thread Tomas B. Winkler


Hi
Could someone, please give me a little example on how to use listen/notify
mechanism. Or at least point me to some more legible documentation.
What I particulary need is that my frontend application is notified on
update/insert in a table.
Thanx a lot.

Tomas Winkler
The System Group
CSE HUJI




[GENERAL] Are there limits to number of INSERTS inside a Transaction?

2000-07-12 Thread Ken Causey

I can tell this is going to be a good day, it's my second stupid question
of the day.  Thanks to Alex Bolenok for a complete, concise answer to my
first question!

Now the question:  Can I do too much inside a transaction?  In other
words, say I was importing a file with 100,000 records and I wanted
to make sure either the whole thing imported or none of it; would it
be a bad idea to do ALL of the inserts within a single transaction?

Are there any limits to the number of inserts/updates within a transaction?

Ken Causey 



Re: [GENERAL] How to remove a user ?

2000-07-12 Thread Justin Jaynes

You can use the command DROP USER username;
at the interactive sql prompt.

Justin

From: "Fred" [EMAIL PROTECTED]
Reply-To: "Fred" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [GENERAL] How to remove a user ?
Date: Tue, 11 Jul 2000 21:09:53 GMT

Hi,

How to remove a user  in postgres ?

Thanks

fred




Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com




[GENERAL] Re: [INTERFACES] Re: Link to postgesql components

2000-07-12 Thread Byron Nikolaidis


While you're at it...

How about links to all the other front-ends, like the odbc and jdbc drivers
for example?   I know there are plenty more front-ends and useful things
that should appear in some kind of "links" section or something.

I went looking for the jdbc driver on the postgresql.org site today and
spent several frustrating minutes looking for it but could not find it.  All
I wanted was the latest jar files.   I had to resort to going to yahoo and
searching for it, and then found Peter's site.

This seems not so good to me.   Is it that hard to have a section for
front-ends and other things?   A simple one line description and a link
would be all that's necessary.

Byron

- Original Message -
From: Vince Vielhaber [EMAIL PROTECTED]
To: Bruce Momjian [EMAIL PROTECTED]
Cc: Sergey Seroukhov [EMAIL PROTECTED]; [EMAIL PROTECTED];
PostgreSQL-general [EMAIL PROTECTED]; PostgreSQL-interfaces
[EMAIL PROTECTED]
Sent: Monday, July 10, 2000 9:47 PM
Subject: [INTERFACES] Re: Link to postgesql components



 I'm just waiting on a 2-3 line description for the web page from him.
 I already requested it.

 Vince.

 On Mon, 10 Jul 2000, Bruce Momjian wrote:

  I am CC'ing the webmaster to add this to our site, and the general list
  so they know it exists.  Thanks.
 
 
  [ Charset KOI8-R unsupported, converting... ]
   Hello!
  
   Some time ago we talk about link to Delphi components for
   PostgreSql.
  
   We not so long ago made a new site http://www.zeos.dn.ua
   and release a new 4.0 version for postgresql users.
  
   Tests of latest 4.1 version show that our components
   faster more than 85% that PostgreSqlODBC+BDE and have some
   extra capabilites. More over these components are OpenSource
   and Freeware that correspond to spirit PostgreSql.
  
   Regrettably postgresql users nearly do not know about our
   components. Can you make a links on your site and documentation
   for Zeos Database Objects (current version is 4.0)?
  
  Regards,
  
   Sergey Seroukhov, leader of Capella Development Group
  
 
 
 

 --
 ==
 Vince Vielhaber -- KA8CSHemail: [EMAIL PROTECTED]http://www.pop4.net
  128K ISDN from $22.00/mo - 56K Dialup from $16.00/mo at Pop4 Networking
 Online Campground Directoryhttp://www.camping-usa.com
Online Giftshop Superstorehttp://www.cloudninegifts.com
 ==







Re: [GENERAL] Another mySQL to PostgreSQL move question

2000-07-12 Thread Giulio Orsero

On Mon, 10 Jul 2000 13:55:24 -0500, you wrote:
 
 Does PostgreSQL support something like mySQL's auto_increment tag? 
See question 4.16.1 of
   http://www.postgresql.org/docs/faq-english.html

I've never used MySQL, and I'm new to PostgreSQL, can you explain me
what does the following mean? 

[ From the PHPBuilder MySQl/PostgreSQL report:
http://www.phpbuilder.com/columns/tim2705.php3 ]

".. MySQL is "smart" enough to increment its auto_increment value when
you import data, whereas Postgres' sequence does not get reset when you
import data, causing all new inserts to fail..."

Does it refer to when you import data with COPY (MySQL's LOAD DATA)?
What actually happens to the sequence when you use COPY?

Thanks.

-- 
[EMAIL PROTECTED]



Re: [GENERAL] Re: [INTERFACES] Re: Link to postgesql components

2000-07-12 Thread Vince Vielhaber

On Mon, 10 Jul 2000, Byron Nikolaidis wrote:

 
 While you're at it...
 
 How about links to all the other front-ends, like the odbc and jdbc drivers
 for example?   I know there are plenty more front-ends and useful things
 that should appear in some kind of "links" section or something.

Already did it.  Look at Info Central | Interfaces

Vince.
 
 I went looking for the jdbc driver on the postgresql.org site today and
 spent several frustrating minutes looking for it but could not find it.  All
 I wanted was the latest jar files.   I had to resort to going to yahoo and
 searching for it, and then found Peter's site.
 
 This seems not so good to me.   Is it that hard to have a section for
 front-ends and other things?   A simple one line description and a link
 would be all that's necessary.
 
 Byron
 
 - Original Message -
 From: Vince Vielhaber [EMAIL PROTECTED]
 To: Bruce Momjian [EMAIL PROTECTED]
 Cc: Sergey Seroukhov [EMAIL PROTECTED]; [EMAIL PROTECTED];
 PostgreSQL-general [EMAIL PROTECTED]; PostgreSQL-interfaces
 [EMAIL PROTECTED]
 Sent: Monday, July 10, 2000 9:47 PM
 Subject: [INTERFACES] Re: Link to postgesql components
 
 
 
  I'm just waiting on a 2-3 line description for the web page from him.
  I already requested it.
 
  Vince.
 
  On Mon, 10 Jul 2000, Bruce Momjian wrote:
 
   I am CC'ing the webmaster to add this to our site, and the general list
   so they know it exists.  Thanks.
  
  
   [ Charset KOI8-R unsupported, converting... ]
Hello!
   
Some time ago we talk about link to Delphi components for
PostgreSql.
   
We not so long ago made a new site http://www.zeos.dn.ua
and release a new 4.0 version for postgresql users.
   
Tests of latest 4.1 version show that our components
faster more than 85% that PostgreSqlODBC+BDE and have some
extra capabilites. More over these components are OpenSource
and Freeware that correspond to spirit PostgreSql.
   
Regrettably postgresql users nearly do not know about our
components. Can you make a links on your site and documentation
for Zeos Database Objects (current version is 4.0)?
   
   Regards,
   
Sergey Seroukhov, leader of Capella Development Group
   
  
  
  
 
  --
  ==
  Vince Vielhaber -- KA8CSHemail: [EMAIL PROTECTED]http://www.pop4.net
   128K ISDN from $22.00/mo - 56K Dialup from $16.00/mo at Pop4 Networking
  Online Campground Directoryhttp://www.camping-usa.com
 Online Giftshop Superstorehttp://www.cloudninegifts.com
  ==
 
 
 
 
 

-- 
==
Vince Vielhaber -- KA8CSHemail: [EMAIL PROTECTED]http://www.pop4.net
 128K ISDN from $22.00/mo - 56K Dialup from $16.00/mo at Pop4 Networking
Online Campground Directoryhttp://www.camping-usa.com
   Online Giftshop Superstorehttp://www.cloudninegifts.com
==






[GENERAL] Re: [NOVICE] newbie problem on creating table

2000-07-12 Thread Tom Lane

"Thomas Krebs" [EMAIL PROTECTED] writes:
 TRAP: Failed Assertion("!(((bool) (UserId != 0))):", File: "miscinit.c",
 Line: 446)

I think what's causing this is that you can't use zero as a Postgres
userid.  Unfortunately createuser doesn't enforce that restriction;
I'll see about fixing that oversight for 7.1.

regards, tom lane



Re: [GENERAL] Re: importing into postgres from access

2000-07-12 Thread Franck Martin

Alex Bolenok wrote:

  At 16:31 11/07/00 +0930, Stephen Davies wrote:
  You can in fact access an Access database from Linux.
  
  Just install the Universal ODBC stuff from OpenLink
 
  URL please, neither openlink.com nor openlink.org seem to be the right
 places.
 
  Thanks
 
  Steve

 http://www.openlinksw.com

 Alex Bolenok

You can use the Windows ODBC driver of Postgresql and the use access to
export your table to PG via ODBC. Maybe the Upsize wizard will even work...

Cheers.
Franck




Re: [GENERAL] Using curr_val Wisely

2000-07-12 Thread Tom Lane

"Andrew Snow" [EMAIL PROTECTED] writes:
 I'm using curr_val('blah_id_seq') in a transaction like so: (in
 pseudo SQL)

 curr_val() returns the current value of the sequence, in the current
 transaction.

More precisely, currval() returns the same value returned by the most
recent nextval() on that sequence in the current backend --- transaction
boundaries don't matter AFAIR.

If you try currval() without ever having executed nextval() in the
current session, you will see this is so.

(I believe a setval() also causes currval() to become set, but that's
a special case that seldom matters.)

So you need not worry about other backends when using currval().  If you
have rules or triggers that can cause the sequence to get advanced, then
you could get confusing results if you forget these rules/triggers are
being fired.

regards, tom lane



[GENERAL] Number of Tables

2000-07-12 Thread Jackson Ching

Hi,

Is there a limit in PostgreSQL 7.0.2 on how many number of tables can be 
created?

Jack




[GENERAL] binary data ...

2000-07-12 Thread Gabriel López Millán


Hello all.

I'm developer in Java with JDBC2.0.
How can I stora a binary (byte []) (such a certificate X.509,
request of certificate, etc).

 Can I use the Type  String (I think that not)?
  Should I use LOB?

Thanks a lot. Gabi.



Re: [GENERAL] Slashdot discussion

2000-07-12 Thread eschmid+sic

On Mon, Jul 10, 2000 at 08:40:27PM -0300, The Hermit Hacker wrote:
 On Tue, 11 Jul 2000, Graeme Merrall wrote:
 
  
   Is anyone else noticing this: Everytime this sort of thing comes up a
   number of people invariably tell that they are using MySQL because it's
   easier to install, and that PostgreSQL is difficult ("a pain") to install.
   
   I've studied the MySQL installation instructions, and they don't strike me
   as inherently simpler. Is it only perception, or what can we do better?
  Possibly because for most people the process is a simple './configure;
  make; make install'
  
  Pgsql doesn't do this. Not the install process is any less better but
 
 huh?  all i do is './configure;make;make install' ...

And what about CVS?

bash-2.01$ cd ../pgsql
bash-2.01$ cvs -z9 update -dP
cvs [update aborted]: authorization failed: server postgresql.org rejected
access
bash-2.01$ 

-Egon



[GENERAL] pgsql gives ExecutePlan error after empty UPDATE?

2000-07-12 Thread David C Mudie


Hello!  I am using PostgreSQL 7.0.2 on FreeBSD 3.4.  

I am trying to update a table with the results of a 
(possibly empty) selection:

  zorro_4330=# create table foo(bar int4) \g
  CREATE
  zorro_4330=# update foo set bar = count(*) from foo \g
  ERROR:  ExecutePlan: (junk) `ctid' is NULL!

In this example, there are no rows in table "foo" to update.
Why is postgres returning this cryptic error instead of just UPDATE 0?

If I add a sample row, the same query works fine:

zorro_4330=# insert into foo values (1) \g
INSERT 50688 1
zorro_4330=# update foo set bar = count(*) from foo \g
UPDATE 1

If I change my query to update no rows, I get the error again:

zorro_4330=# update foo set bar = count(*) from foo where bar  0 \g
ERROR:  ExecutePlan: (junk) `ctid' is NULL!

Postgres seems to be reporting an error because the update matched no rows,
but this a perfectly legitimate database operation.   I have not
been able to find any documentation on "ExecutePlan" or why it
thinks there is a problem.

Please let me know if you have any suggestions or workarounds for this problem,
or if there is somewhere more appropriate to discuss this.  Thanks!

David

-
David C Mudie   DigitalDeck Inc [EMAIL PROTECTED]
San Mateo CA 94402  http://www.digitaldeck.com



Re: [GENERAL] Re: [INTERFACES] Re: Link to postgesql components

2000-07-12 Thread Jeff Waugh

 Byron Nikolaidis wrote:
 
 How about links to all the other front-ends, like the odbc and jdbc drivers
 for example?   I know there are plenty more front-ends and useful things
 that should appear in some kind of "links" section or something.
 
 This seems not so good to me.   Is it that hard to have a section for
 front-ends and other things?   A simple one line description and a link
 would be all that's necessary.


Bah! Replicating functionality is a waste of time... :)

freshmeat.net lists just about all of the packages available for use with
PostgreSQL, with links to downloads, changelogs, etc.


Fully searchable, very comprehensive.

- Jeff


-- [EMAIL PROTECTED] - http://linux.conf.au/ --

  linux.conf.au - coming to Sydney in January 2001

Installing Linux Around Australia - http://linux.org.au/installfest/




Re: [GENERAL] pgsql gives ExecutePlan error after empty UPDATE?

2000-07-12 Thread Tom Lane

David C Mudie [EMAIL PROTECTED] writes:
   zorro_4330=# update foo set bar = count(*) from foo \g
   ERROR:  ExecutePlan: (junk) `ctid' is NULL!

 Postgres seems to be reporting an error because the update matched no rows,
 but this a perfectly legitimate database operation.

Actually, it's flat-out illegal according to SQL92: thou shalt not
use an aggregate in UPDATE, quoth the standard.  Try it with the
count() in a sub-select, which is legal SQL:

update foo set bar = (select count(*) from foo);

There is a thread going on in pghackers right now about whether it
makes sense to allow aggregates outside sub-selects in UPDATE, and
if so what it should mean exactly.

regards, tom lane



Re: [GENERAL] Re: [NOVICE] newbie problem on creating table

2000-07-12 Thread root

Tom Lane wrote:
 
 "Thomas Krebs" [EMAIL PROTECTED] writes:
  TRAP: Failed Assertion("!(((bool) (UserId != 0))):", File: "miscinit.c",
  Line: 446)
 
 I think what's causing this is that you can't use zero as a Postgres
 userid.  Unfortunately createuser doesn't enforce that restriction;
 I'll see about fixing that oversight for 7.1.
 
 regards, tom lane

Sorry, but I'm think you are wrong.
I run Postgres (7.0.2) without any problems as userid 0.

pg_id says:

"root pg_id
uid=0(root)"

Andreas Maus



Re: [GENERAL] Slashdot discussion

2000-07-12 Thread Lamar Owen

[EMAIL PROTECTED] wrote:
  huh?  all i do is './configure;make;make install' ...
 
 And what about CVS?

Have you changed the CVSROOT since it was changed between 7.0.0 and
7.0.2?

My nightly CVS mirrors have worked perfectly for a long time -- that is,
once I got the CVSROOT change properly done.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11



[GENERAL] Sorry...

2000-07-12 Thread root

Ooops sorry.
Now all options on this machine are now set properly.

My email address is NOT [EMAIL PROTECTED] . It is [EMAIL PROTECTED]
-

Andreas Maus.
-- 
@-@
|   email: [EMAIL PROTECTED]   |
|   http://www.bigfoot.com/~andreas_maus/ |
@-@



Re: [GENERAL] listen/notify

2000-07-12 Thread Tom Lane

"Tomas B. Winkler" [EMAIL PROTECTED] writes:
 Could someone, please give me a little example on how to use listen/notify
 mechanism. Or at least point me to some more legible documentation.
 What I particulary need is that my frontend application is notified on
 update/insert in a table.

Make an ON INSERT OR UPDATE trigger that executes the NOTIFY.

regards, tom lane



Re: [GENERAL] psql and Gnu readline

2000-07-12 Thread J.R. Belding

I had this same problem.  Thanks to a suggestion from Bruce Momjian, I
noticed that the configure script was not finding the readline
libraries.  I checked, and found that though I did have the readline
package installed, I did not have the readline-devel package installed. 
Once I installed that package, the configure script found readline and
after recompiling everything works fine.



Erich wrote:
 
 I've just installed PostgreSQL 7.02 on my OpenBSD box.  Everything is
 working fine.  I made sure to link in gnu readline in psql.  It seems
 to be working, because I can edit a line.  For instance, Ctl-A takes
 me to the beginning of a line, Ctl-K kills it, etc.  However, Ctl-P
 doesn't go up a line, so I can't access previous lines, and lines are
 not saved in the .psql_history file which is mentioned on the man
 page.
 
 Any idea what to do?  Line editing is so handy to have in something
 like this.
 
 Thanks,
 
 e



[GENERAL] psql \i

2000-07-12 Thread Richard Harvey Chapman

I have a text file of SQL commands which contains tabs.  I used to be able
to import it using psql using "\i file.sql".  Now, I've upgraded to 7.0.2
and it treats the file as if I'm entering it all in manually.  It treats
the tabs as completion commands.

CREATE TABLE alpha (
TABnumTABSERIAL PRIMARY KEY
);

will return a syntax error at PRIMARY because it sees the following:

CREATE TABLE alpha (
numSERIAL PRIMARY KEY
);

Is there something new that I have to do?

(besides converting the tabs -- if all else fails, I'll do that)

R.





Re: [GENERAL] Re: [NOVICE] newbie problem on creating table

2000-07-12 Thread Peter Eisentraut

Tom Lane writes:

 "Thomas Krebs" [EMAIL PROTECTED] writes:
  TRAP: Failed Assertion("!(((bool) (UserId != 0))):", File: "miscinit.c",
  Line: 446)
 
 I think what's causing this is that you can't use zero as a Postgres
 userid.  Unfortunately createuser doesn't enforce that restriction;
 I'll see about fixing that oversight for 7.1.

Create User does, but initdb doesn't.


-- 
Peter Eisentraut  Sernanders väg 10:115
[EMAIL PROTECTED]   75262 Uppsala
http://yi.org/peter-e/Sweden




Re: [GENERAL] Re: [NOVICE] newbie problem on creating table

2000-07-12 Thread Tom Lane

Peter Eisentraut [EMAIL PROTECTED] writes:
 TRAP: Failed Assertion("!(((bool) (UserId != 0))):", File: "miscinit.c",
 Line: 446)
 
 I think what's causing this is that you can't use zero as a Postgres
 userid.  Unfortunately createuser doesn't enforce that restriction;
 I'll see about fixing that oversight for 7.1.

 Create User does, but initdb doesn't.

Hmm.  But we have other defenses against the postgres superuser being
root.  I had assumed that the issue here was a non-superuser Postgres
account being created with zero userid...

regards, tom lane



Re: [GENERAL] sql question

2000-07-12 Thread Ross J. Reedstrom

On Wed, Jul 12, 2000 at 05:33:09PM -0500, Travis Bauer wrote:
 
 Let's say I have a table t1 with two fields, x and y.  How do I write an
 sql statement like:
 
 select x if y1 else 0 from t1;

SELECT CASE WHEN y1 THEN x ELSE 0 END FROM t1;

From page 33 of Bruce's book, at:

http://www.postgresql.org/docs/aw_pgsql_book/node52.html

Ross
-- 
Ross J. Reedstrom, Ph.D., [EMAIL PROTECTED] 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005



Re: [GENERAL] Triggers with arguments

2000-07-12 Thread Richard Harvey Chapman

If I understand correctly, you have something like this:

CREATE TABLE rec_* (
num   integer primary key;
other ...
);

CREATE TABLE notes (
name   CHAR(20),
numINTEGER,
note   VARCHAR(200),
   PRIMARY KEY(name, num)
);

So, you have many different tables like rec_*, and one notes table that
can refer to them all.

Perhaps then, you want something like this:

CREATE TABLE notes (
name   CHAR(20),
numINTEGER REFERENCES rec_* 
 ON UPDATE CASCADE
 ON DELETE CASCADE,
note   VARCHAR(200),
   PRIMARY KEY(name, num)
);

'cept I just realized that a column can't reference multiple tables (can
it?).  Anyway, I found the above idea in Bruce's book in Chapter 14,
"Modification of Primary Key Row."

If I'm reading it correctly, deleting the record from rec_*, should cause
the corresponding record in notes to be deleted as well.

perhaps this'll help,

R.




On Wed, 12 Jul 2000, Scott Holmes wrote:

 I'm afraid I just don't see how this is done without being able to pass 
 arguments to the procedure or actually running an additional SQL statement 
 within the trigger:
   
   I have a "notes" table that is potentially linked to records in many other 
 tables.  The primary key is created from 1) the name of the table, and 2) the 
 primary key value of that table.  When one of these records, with notes, is 
 deleted, I need to make sure that the notes records are deleted as well.
 
 I've been playing around with this and perhaps my code that doesn't work will 
 illustrate what I need to accomplish and perhaps one of you kind readers will 
 show me just how to do it.
 
 CREATE FUNCTION del_stxnoted () RETURNS opaque AS '
   DECLARE
 fname alias for $1;
 rkey alias for $2;
   BEGIN
 delete from stxnoted where filename = fname
and record_key = rkey;
   END;'
 LANGUAGE 'plpgsql';
 
 
 create trigger del_location_trig
 after delete
   on location
   for each row
 execute procedure del_stxnoted("location", 'old.wher');
 
 Postgres will not create this trigger as it does not recognize the function 
 del_stxnoted as actually existing.
 
 
 I am attempting to convert a large suite of applications that currently run on 
 an Informix database.  The syntax for this is
 
 create trigger del_location delete on location referencing
 old as pre_del
 for each row
 (
 delete from stxnoted  where ((filename = 'location' ) AND (record_key
 = pre_del.wher ) ) );
 
 
 Thanks,  Scott
 
 
 
 




Re: [GENERAL] Having a problem compiling plperl.

2000-07-12 Thread Tom Lane

"KMiller" [EMAIL PROTECTED] writes:
 Having a problem compiling plperl.

Try configuring with
perl Makefile.PL POLLUTE=1

Known compatibility problem with newer perls ...

regards, tom lane



[GENERAL] Figured it out (psql and Gnu readline)

2000-07-12 Thread Erich


With some helpful hints from various people, I figured out how to get
this to work, and now my life is more pleasant and meaningful.

Situation: Stock installation of OpenBSD 2.7, with PostgreSQL 7.0.2.
I installed postgres by downloading the source tar and compiling, not
by going through /usr/ports.

Anyway, I'm not sure if OpenBSD ships with readline or whatever, so I
downloaded the latest readline (4.1) and compiled and installed it.  I
then did ./configure in postgres, and recompiled psql, and it still
didn't have history.

Following some sugestions on this group, I figured out the problem.
First, there is no history.h with readline 4.1.  There's
readline/history.h.  So I modified Makefile.global to include that
file.  Also, I had to edit config.h, with several tweaks to various
defines.  I had to tell it that there is no history.h, but there is a
readline/history.h.  I had to put in that there is no history function
in libreadline, and it must also use libhistory.  Etc.

After doing all that, it worked beautifully.  I often have to do a
sequence of slighly varied inserts, etc, and this is much better.

Maybe for the next release, there should be better handling of gnu
readline 4.1?  Or maybe it should come with the package?  Just a
thought.

e


-- 
This message was my two cents worth.  Please deposit two cents into my
e-gold account by following this link:
http://rootworks.com/twocentsworth.cgi?102861
275A B627 1826 D627 ED35  B8DF 7DDE 4428 0F5C 4454



Re: [GENERAL] Figured it out (psql and Gnu readline)

2000-07-12 Thread Tom Lane

Erich [EMAIL PROTECTED] writes:
 Following some sugestions on this group, I figured out the problem.
 First, there is no history.h with readline 4.1.  There's
 readline/history.h.  So I modified Makefile.global to include that
 file.  Also, I had to edit config.h, with several tweaks to various
 defines.  I had to tell it that there is no history.h, but there is a
 readline/history.h.  I had to put in that there is no history function
 in libreadline, and it must also use libhistory.  Etc.

configure is supposed to handle all that for you ... if it failed
to find the right location of libreadline and associated includes
then the question is why.  You sure you ran configure after installing
the include files?

regards, tom lane



Re: [GENERAL] Triggers with arguments

2000-07-12 Thread Scott Holmes

What I'm after are triggers on delete fro several tables calling the same 
procedure.  I am not at liberty to change the schema of the database as I need 
to accomodate what is actually an ancient system - that goes back before the 
days of blobs and large text fields.  In my example, deleting a record from 
the "location" table, the trigger needs to delete associated rows from the 
notes table.  The notes table is indexed by fields for 1) a table name (in 
this case "location", and 2) a record key (the value of the primary field in 
the location table).

In postgresql, the trigger execute a procedure that must be defined with no 
arguments and returning opaque.  What I don't know how to do is write a 
procedure that knows the values for the notes table index key (table name and 
primary key value).  Examples in the manual indicate that arguments may indeed 
be passed, and it refers to such procedures as general trigger functions.  I, 
however, have not been able to figureout how to write such functions.

Thanks, Scott





Re: [GENERAL] Figured it out (psql and Gnu readline)

2000-07-12 Thread Erich


 configure is supposed to handle all that for you ... if it failed to
 find the right location of libreadline and associated includes then
 the question is why.  You sure you ran configure after installing
 the include files?

I just deleted my postgres tree, and then unpacked it again, and ran
configure again.  libreadline.a and libhistory.a are in
/usr/local/lib/.  readline.h and history.h are in
/usr/local/include/readline/.

I then ran ./configure.

When I look at config.h, I can see that it failed to detect
/usr/local/include/readline/history.h.  Also, I see that it did define
HAVE_HISTORY_IN_READLINE 1 which is incorrect.  I would have to make
the change by hand to the file.

I think it may be a bug.

e



Re: [GENERAL] Triggers with arguments

2000-07-12 Thread Tom Lane

Scott Holmes  [EMAIL PROTECTED] writes:
 CREATE FUNCTION del_stxnoted () RETURNS opaque AS '
   DECLARE
 fname alias for $1;
 rkey alias for $2;
   BEGIN
 delete from stxnoted where filename = fname
and record_key = rkey;
   END;'
 LANGUAGE 'plpgsql';

 create trigger del_location_trig
 after delete
   on location
   for each row
 execute procedure del_stxnoted("location", 'old.wher');

 Postgres will not create this trigger as it does not recognize the function 
 del_stxnoted as actually existing.

Uh, the trigger creates just fine for me.  I think your problem is
with the way you're trying to get at the trigger arguments in the
function body.  There's an example of the right way in the plpgsql
regress test:

create function tg_chkslotname() returns opaque as '
begin
if substr(new.slotname, 1, 2) != tg_argv[0] then
raise exception ''slotname must begin with %'', tg_argv[0];
end if;
return new;
end;
' language 'plpgsql';

create trigger tg_chkslotname before insert
on PSlot for each row execute procedure tg_chkslotname('PS');

create trigger tg_chkslotname before insert
on WSlot for each row execute procedure tg_chkslotname('WS');


The documentation mentions tg_argv[] but doesn't seem to give an example
:-(

regards, tom lane



Re: [GENERAL] Figured it out (psql and Gnu readline)

2000-07-12 Thread Tom Lane

Erich [EMAIL PROTECTED] writes:
 configure is supposed to handle all that for you ... if it failed to
 find the right location of libreadline and associated includes then
 the question is why.  You sure you ran configure after installing
 the include files?

 I just deleted my postgres tree, and then unpacked it again, and ran
 configure again.  libreadline.a and libhistory.a are in
 /usr/local/lib/.  readline.h and history.h are in
 /usr/local/include/readline/.

OK ... my setup has the same files in the same places ...

 I then ran ./configure.

 When I look at config.h, I can see that it failed to detect
 /usr/local/include/readline/history.h.  Also, I see that it did define
 HAVE_HISTORY_IN_READLINE 1 which is incorrect.  I would have to make
 the change by hand to the file.

Well, that's darn peculiar.  configure.in has a test for
readline/history.h, big as life:
AC_CHECK_HEADERS(readline/history.h)
Does the config.log file show why it failed to find the include?

HAVE_HISTORY_IN_READLINE seems to get defined if libreadline.a contains
a "using_history" symbol:

AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE),
AC_CHECK_LIB(history,  main) )


On my setup, which is readline 4.0 if I'm checking the right files,
HAVE_HISTORY_IN_READLINE does get defined, and AFAICT libhistory.a
doesn't get linked, but I most certainly do get history support.

Which readline version are you using?  Maybe the GNU guys rearranged
which functions live in which library.  If so, we probably need
to be probing for a different symbol in libreadline to be compatible
across more libreadline versions ...

regards, tom lane



Re: [GENERAL] RE: [HACKERS] pg_dump blobs - editable dump?

2000-07-12 Thread Philip Warner

At 07:58 13/07/00 +1000, Giles Lean wrote:

I recommend you compress the whole stream, not the pieces.  Presumably
you can determine the size of the pieces you're backing up, and ending
with a .tar.gz (or whatever) file is more convenient to manage than a
.tar file of compressed pieces unless you really expect people to be
extracting individual files from the backup very often.

Having to pass everything through /tmp would be really unfortunate.


The only things I compress are the table data and the blobs (ie. the big
things); unfortunately, the table data is of unknown uncompressed size. I
*could* do two 'COPY TO STDOUT' calls, just to get the size, but that seems
like a very bad idea.



Philip Warner| __---_
Albatross Consulting Pty. Ltd.   |/   -  \
(A.C.N. 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   |/



[GENERAL] How to get PL languages to work in Postgres

2000-07-12 Thread Erich


I'm sure this is a dumb question, but...

When I try to create a PL/pgSQL function, even a very simple one like
the add_one function in the example, I get this error:

ERROR:  Unrecognized language specified in a CREATE FUNCTION: 'plpgsql'.  Recognized 
languages are sql, C, internal and the created procedural languages.

Do you have any idea how to get it to work?  I just compiled and
installed Postgres in the normal way.  I can see that there is a
plpgsql.so in /usr/local/pgsql/lib.

Have I missed an installation option?  Anything else I should do?

Thanks,

e



Re: [GENERAL] PostgreSQL and Access (via ODBC)

2000-07-12 Thread Froilan Mendoza


On Wed, 12 Jul 2000, Sean Weissensee wrote:

 When importing in Access, it would have prompted you to select a unique
 ID for each table, did you assign this ?

Im pretty new to this, so please bear with me :)

if unique id ~= create unique index myindex on table (field)

then yes ...

if not, how do you assign a unique id?

TIA again.

---
Froilan C. Mendoza  
Tridel Technologies, Inc.
http://www.tridel.net




Re: [GENERAL] Figured it out (psql and Gnu readline)

2000-07-12 Thread Stephan Szabo

Here's a stupid question,

What happens if you do the same kind of compile on a similar program from
your shell (a simple program that includes readline/history.h, with and
without -I/usr/local/include?
I'm just wondering if the compiler is not looking in /usr/local/include by
default and is not finding the header because of that...

- Original Message -
From: "Erich" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, July 12, 2000 6:12 PM
Subject: Re: [GENERAL] Figured it out (psql and Gnu readline)



  Well, that's darn peculiar.  configure.in has a test for
  readline/history.h, big as life:
  AC_CHECK_HEADERS(readline/history.h)
  Does the config.log file show why it failed to find the include?

 Here's the lines from config.log:

 configure:2539: checking for main in -lreadline
 configure:2554: gcc -o conftest -O2 -pipe
   conftest.c -lreadline  -ltermcap -lcurses  15
 configure:2582: checking for using_history in -lreadline
 configure:2601: gcc -o conftest -O2 -pipe
   conftest.c -lreadline  -lreadline -ltermcap -lcurses  15
 configure:3833: checking for history.h
 configure:3843: gcc -E   conftest.c /dev/null 2conftest.out
 configure:3839: history.h: No such file or directory
 configure: failed program was:
 #line 3838 "configure"
 #include "confdefs.h"
 #include history.h
 configure:3873: checking for ieeefp.h
 configure:3883: gcc -E   conftest.c /dev/null 2conftest.out
 configure:3913: checking for limits.h
 configure:3923: gcc -E   conftest.c /dev/null 2conftest.out
 configure:3953: checking for netdb.h
 configure:3963: gcc -E   conftest.c /dev/null 2conftest.out
 configure:3993: checking for netinet/in.h
 configure:4003: gcc -E   conftest.c /dev/null 2conftest.out
 configure:4033: checking for readline.h
 configure:4043: gcc -E   conftest.c /dev/null 2conftest.out
 configure:4039: readline.h: No such file or directory
 configure: failed program was:
 #line 4038 "configure"
 #include "confdefs.h"
 #include readline.h
 configure:4073: checking for readline/history.h
 configure:4083: gcc -E   conftest.c /dev/null 2conftest.out
 configure:4079: readline/history.h: No such file or directory
 configure: failed program was:
 #line 4078 "configure"
 #include "confdefs.h"
 #include readline/history.h
 configure:4113: checking for readline/readline.h
 configure:4123: gcc -E   conftest.c /dev/null 2conftest.out
 configure:4153: checking for sys/select.h
 configure:4163: gcc -E   conftest.c /dev/null 2conftest.out
 configure:4193: checking for termios.h
 configure:4203: gcc -E   conftest.c /dev/null 2conftest.out
 configure:4233: checking for unistd.h
 configure:4243: gcc -E   conftest.c /dev/null 2conftest.out
 configure:4273: checking for values.h
 configure:4283: gcc -E   conftest.c /dev/null 2conftest.out
 configure:4279: values.h: No such file or directory
 configure: failed program was:
 #line 4278 "configure"


  On my setup, which is readline 4.0 if I'm checking the right files,
  HAVE_HISTORY_IN_READLINE does get defined, and AFAICT libhistory.a
  doesn't get linked, but I most certainly do get history support.
 
  Which readline version are you using?  Maybe the GNU guys rearranged
  which functions live in which library.  If so, we probably need
  to be probing for a different symbol in libreadline to be compatible
  across more libreadline versions ...

 I'm using readline 4.1, compiled from the distribution.  In other
 words, I didn't get it from /usr/ports, which is what OpenBSD normally
 uses.

 I have a stupid ./configure question: Whenever I compile something, I
 never want to have -g as a CC option.  How do I tell configure not to
 use -g as a CC option?  I only want -O2.  Usually I go through and
 edit Makefiles by hand after configure is done, but that's annoying.

 e






Re: [GENERAL] Triggers with arguments

2000-07-12 Thread Robert B. Easter

On Wed, 12 Jul 2000, Scott Holmes wrote:
 I'm afraid I just don't see how this is done without being able to pass 
 arguments to the procedure or actually running an additional SQL statement 
 within the trigger:
   
   I have a "notes" table that is potentially linked to records in many other 
 tables.  The primary key is created from 1) the name of the table, and 2) the 
 primary key value of that table.  When one of these records, with notes, is 
 deleted, I need to make sure that the notes records are deleted as well.
 
 I've been playing around with this and perhaps my code that doesn't work will 
 illustrate what I need to accomplish and perhaps one of you kind readers will 
 show me just how to do it.
 
 CREATE FUNCTION del_stxnoted () RETURNS opaque AS '
   DECLARE
 fname alias for $1;
 rkey alias for $2;
   BEGIN
 delete from stxnoted where filename = fname
and record_key = rkey;
   END;'
 LANGUAGE 'plpgsql';
 
 
 create trigger del_location_trig
 after delete
   on location
   for each row
 execute procedure del_stxnoted("location", 'old.wher');
 
 Postgres will not create this trigger as it does not recognize the function 
 del_stxnoted as actually existing.
 
 
 I am attempting to convert a large suite of applications that currently run on 
 an Informix database.  The syntax for this is
 
 create trigger del_location delete on location referencing
 old as pre_del
 for each row
 (
 delete from stxnoted  where ((filename = 'location' ) AND (record_key
 = pre_del.wher ) ) );
 
 
 Thanks,  Scott

Maybe try it like this:

CREATE FUNCTION del_stxnoted() RETURNS OPAQUE AS '
BEGIN
DELETE FROM stxnoted WHERE filename = OLD.fname AND record_key = OLD.rkey;
END;
' LANGUAGE 'plpgsql';  
 
CREATE TRIGGER del_location_trig
AFTER DELETE ON location FOR EACH ROW
EXECUTE PROCEDURE del_stxnoted();


- Robert



[GENERAL] pgsql setup

2000-07-12 Thread Carsten Huettl

Hello,

I am runing pgsql with suse linux v.6.4

I have installed pgsql with rpm.
 When I start initdb as user postgres I get the following error:

/usr/lib/pgsql/bin/initdb: pg_id: command not found
Unable to determine a valid username.  If you are running
initdb without an explicit username specified, then there
may be a problem with finding the Postgres shared library
and/or the pg_id utility.

What can I do do fix this?

TIA
C.


-- 
Carsten Huettl - http://www.ahorn-Net.de
pgp-key on request



[GENERAL] select for update not locking properly.

2000-07-12 Thread Joseph Shraibman

I have a program that does this:
BEGIN;
SELECT mystring FROM mytable WHERE x = 3 AND y = 4 FOR UPDATE;
my program takes mystring and appends to it
UPDATE mytable SET mystring = 'appended string here' WHERE x = 3 AND y
= 4;
END;

But the locking isn't working properly.  I do something that should
cause 3 different threads to try and do that append, and the first one
goes through properly, but the second two append to the result of the
first on only, meaning that the third one didn't see the result of the
second's append.

I tried to make a simple example that reproduced this, but failed.

I'm guessing that the value of that the select is generated before the
row is locked, and thus each of my last two threads saw the table after
the first append, *then* one of them blocked because the other had
locked the table. It's the only thing I can figure.



Re: [GENERAL] select for update not locking properly.

2000-07-12 Thread Joseph Shraibman

And I forgot to mention my version is:

PostgreSQL 7.0.1 on i686-pc-linux-gnu, compiled by gcc egcs-2.91.66


Joseph Shraibman wrote:
 
 I have a program that does this:
 BEGIN;
 SELECT mystring FROM mytable WHERE x = 3 AND y = 4 FOR UPDATE;
 my program takes mystring and appends to it
 UPDATE mytable SET mystring = 'appended string here' WHERE x = 3 AND y
 = 4;
 END;
 
 But the locking isn't working properly.  I do something that should
 cause 3 different threads to try and do that append, and the first one
 goes through properly, but the second two append to the result of the
 first on only, meaning that the third one didn't see the result of the
 second's append.
 
 I tried to make a simple example that reproduced this, but failed.
 
 I'm guessing that the value of that the select is generated before the
 row is locked, and thus each of my last two threads saw the table after
 the first append, *then* one of them blocked because the other had
 locked the table. It's the only thing I can figure.



[GENERAL] Getting closer with functions, but...

2000-07-12 Thread Scott Holmes


This function works but is not selective enough.  The tg_argv[] are pointers 
to the arguments passed.  And they do work correctly.

CREATE FUNCTION del_stxnoted () RETURNS opaque AS '
declare
  fname text;
  rkey text;
  BEGIN
fname := tg_argv[0];
rkey := ''old.'' || tg_argv[1];
delete from stxnoted where record_key = old.wher;
return old;
  END;'
LANGUAGE 'plpgsql';

What I need can be accomplished with a rather massive if/then series:

if fname = "location" then
  delete from stxnoted where filename = "location" and record_key = old.wher;
end if

if fname = "events" then
  delete from stxnoted where filename = "events" and record_key = old.evntnmbr;
end if

... ( maybe 100 different tables )...

It seems the sql statement needs old.field or new.field to provide a value.  
Unfortunately, my first value, fname, is not a field value but a table name 
and my second value may have one of several field names.

Is there a syntax that will allow me to build an sql statement for use in 
theis funcation (ie delete from stxnoted where filename = fname and record_key 
= rkey).

Thanks, Scott






Re: [GENERAL] Getting closer with functions, but...

2000-07-12 Thread Tom Lane

Scott Holmes  [EMAIL PROTECTED] writes:
 Is there a syntax that will allow me to build an sql statement for use
 in theis funcation (ie delete from stxnoted where filename = fname and
 record_key = rkey).

Not in plpgsql, because it wants to precompile the queries, so you can't
determine table or field names at runtime, just substitute values for
constants.

pltcl doesn't precompile, so it should do what you want (at a price in
performance of course).  I think plperl works like pltcl, if you prefer
perl over tcl.

regards, tom lane



[GENERAL] References on functions?

2000-07-12 Thread Erich


I'm starting to write functions in plpgsql, and I can do the basic
stuff just fine, but the language isn't so well documented.  Is there
any good tutorial on the language?  Or should I switch over to perl?
I would rather learn plpgsql than do it in perl, because I would guess
that plpgsql is faster and more optimized for working in Postgres.
Any source of better docs?

Thanks,

e

-- 
This message was my two cents worth.  Please deposit two cents into my
e-gold account by following this link:
http://rootworks.com/twocentsworth.cgi?102861
275A B627 1826 D627 ED35  B8DF 7DDE 4428 0F5C 4454