Re: [GENERAL] Need PostgreSQL startup scripts

2001-04-02 Thread Peter Eisentraut

Justin Clift writes:

> Now that I know you are already addressing this, I'm not sure they need
> to be on the techdocs site.  I don't think we should have too much
> duplication and therefore wasted effort.
>
> Do you think it would be better to remove the startup scripts section
> from the techdocs site, or leave it there?

Feel free to keep them there.  Maybe it's better to track them on the web,
since distributions change so often.  The ones in contrib are more "proof
of concept" types anyway.

Once we have a large collection of scripts we can perhaps consolidate them
and make a few of them official.

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


---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



Re: [GENERAL] Can I get the default value for an attribute (field) ?

2001-04-02 Thread ADBAAMD

Mike Mascari wrote:

> If you start psql with the -E option you'll see it generates a query 
> similar to the following:
> 
> SELECT substring(d.adsrc for 128) FROM pg_attrdef d, pg_class c
> WHERE c.relname = 'my_table' AND c.oid = d.adrelid NAD d.adnum = X
> 
> where my_table is the table in question and X is the column number 
> within that table.

Is there a way to do it in the properly relational way, I mean, using 
attribute (column) name instead of a number?




-- 
  _
/ \   Leandro Guimarães Faria Corsetti Dutra +55 (11) 3040 8913
\ /   Amdocs at Bell Canada  +1 (514) 786 87 47
  XSupport Center, São Paulo, Brazil  mailto:[EMAIL PROTECTED]
/ \   http://terravista.pt./Enseada/1989/mailto:[EMAIL PROTECTED]



---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



[GENERAL] compile error

2001-04-02 Thread Soma Interesting

I'm attempting to recompile postgres with perl support. Perl compiled fine, 
however postgres insists on compiling with odbc...

I'm getting the following error when I attempt to ./configure

linking ./include/port to interfaces/odbc/port
mkdir: cannot create directory `interfaces/odbc': No such file or directory
ln: ./include/port: hard link not allowed for directory
configure: error: can not link interfaces/odbc/port to ./include/port

using the following ./configure statement:

./configure --prefix=/usr/lib/pgsql --with-perl --enable-multibyte 
--with-odbc=no

I only added the --with-odbc=no, after it gave the above error. Compiling 
is pretty new to me, so its probably something simple that I'm doing wrong.


---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



[GENERAL] What could be the reason for EXTREMELY slow INSERTs?

2001-04-02 Thread Daniel ?erud

I have this little test application that compares 
retreiving and inserting data using indexes and not using 
indexes. I have tried this program on two different 
machines. One is a PIII 533 256 meg memory and SCSI. The 
other one is a dual 400 (something) 512 meg memory. The 
thing is that the PII _SELECTS_ faster (this is OK since 
the program uses one thread/process) than the dual 400 but 
inserts is a complete different story.

1 inserts takes 665 seconds on the PIII 533, while on 
the dual 400 it takes about 13 seconds (*GULP!*). I have 
done a clean reinstallation (dpkg --purge postgresql, apt-
get install postgresql) and tried it again. Same results. 
Do you guys know what could be the reason?

Thanks.

Daniel Åkerud


---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [GENERAL] What could be the reason for EXTREMELY slow INSERTs?

2001-04-02 Thread Tom Lane

Daniel ?erud <[EMAIL PROTECTED]> writes:
> 1 inserts takes 665 seconds on the PIII 533, while on 
> the dual 400 it takes about 13 seconds (*GULP!*).

Maybe postmaster running with -F on one system but not the other?
Or referential integrity checks defined on one table and
not the other?

regards, tom lane

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [GENERAL] What could be the reason for EXTREMELY slow INSERTs?

2001-04-02 Thread Poul L. Christiansen

Try to run a vacuum on the box with slow inserts (don't know if that
helps, though).

Run a /sbin/hdparm -t , to compare the speed of the harddisks.

HTH,
Poul L. Christiansen

Daniel ?erud wrote:
> 
> I have this little test application that compares
> retreiving and inserting data using indexes and not using
> indexes. I have tried this program on two different
> machines. One is a PIII 533 256 meg memory and SCSI. The
> other one is a dual 400 (something) 512 meg memory. The
> thing is that the PII _SELECTS_ faster (this is OK since
> the program uses one thread/process) than the dual 400 but
> inserts is a complete different story.
> 
> 1 inserts takes 665 seconds on the PIII 533, while on
> the dual 400 it takes about 13 seconds (*GULP!*). I have
> done a clean reinstallation (dpkg --purge postgresql, apt-
> get install postgresql) and tried it again. Same results.
> Do you guys know what could be the reason?
> 
> Thanks.
> 
> Daniel Åkerud
> 
> ---(end of broadcast)---
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to [EMAIL PROTECTED] so that your
> message can get through to the mailing list cleanly

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



Re: [GENERAL] function to operate on same fields, different records?

2001-04-02 Thread will trillich

On Mon, Apr 02, 2001 at 10:21:34AM -0400, Tom Lane wrote:
> will trillich <[EMAIL PROTECTED]> writes:
> > i've tried
> > create function gpa(OPAQUE) 
> > and psql tells me it successfully
> > CREATED
> > something, but
> > \df
> > shows no such function.
> 
> I believe \df suppresses opaque-argument functions, on the theory that
> they're probably just I/O functions.  But OPAQUE won't do you any good
> anyway unless you code the function in C.
> 
> > what arg to i specify to allow varying records (with a subset of
> > exactly-the-same-names field subset) to be passed to a function?
> 
> Inheritance seems to work for this in current sources:
> 
> regression=# create table p1 (f1 int);
> CREATE
> regression=# create table p2 (f2 int) inherits (p1);
> CREATE
> regression=# create function getf1(p1) returns int as '
> regression'# select $1.f1' language 'sql';
> CREATE
> regression=# insert into p1 values(1);
> INSERT 1030276 1
> regression=# insert into p2 values(11,22);
> INSERT 1030277 1
> regression=# select getf1(p1) from p1;
>  getf1
> ---
>  1
> 11
> (2 rows)

ding! light comes on ... never thought of that. mucho cool, mucho
thanks! lots of new exploring to delve into now...

-- 
does a brain cell think?

[EMAIL PROTECTED]
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



[GENERAL] problem with subselect: NOT IN

2001-04-02 Thread Kevin L

Hi.

here's my scenario: table employee has emp_id and employee
details. table salesorder has emp_id and sales details.

The following works fine: (get all employees who have sold
something)

SELECT emp_id FROM employee WHERE emp_id IN (SELECT emp_id FROM
salesorder);

However, getting employees who have NOT sold something always
returns zero rows:

SELECT emp_id FROM employee WHERE emp_id NOT IN (SELECT emp_id
FROM workorder);

Has anyone encountered this before? I know the second query
should return something because the data is in the table.

thanks!

-Kevin

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



[GENERAL] Re: bitwise again

2001-04-02 Thread Philip Hallstrom

As someone else pointed out you can upgrade to 7.1.  Or you can add your
own operators/functions.

I've included the C source and SQL create script.  You'll need to do this
as the postgres superuser.  And you'll probably need to edit the SQL
script and adjust the path of the .so file.  The .c file has what I use
for compilation (you'll need to tweak that as well).

The only gotcha is that you can't remove the NOT operator (it's a bug in
7.0.3) using the DROP OPERATOR statement.

-philip

On Mon, 2 Apr 2001, Alexander Lohse wrote:

> Hi,
>
> I am having serious troubles to move my DBs from MySQL to Postgres.
>
> In MySQL I use following bitwise operation on an INT field:
>
> $q = "select id from my_tbl where aid & 2";
>
> In Postgres I tried the same, but I found no working solution.
>
> My basic questions:
>
> Is it better(or even possible) to use bitwise operator on an int4
> field or shall I prefer the varbit?
> (In my logic I would prefer int4!)
>
> Using the above as in MySQL, I get an ERROR:
> WHERE clause must return type bool, not type int4
>
> Can anyone point me to a right doc or kickstart myself?
>
> Thanx,
>
> Alex
>
>
>
> --
> ___
> Alexander Lohse
> Human Touch Medienproduktion GmbH
> Am See 1
> 17440 Klein Jasedow
>
> Tel: (038374) 75211
> Fax: (038374) 75223
> eMail: [EMAIL PROTECTED]
> http://www.humantouch.de
>
> ---(end of broadcast)---
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
>


/*
gcc -I/local/src/postgresql-7.0.3/src/include 
-I/local/src/postgresql-7.0.3/src/backend   \
-O2 -m486 -pipe -Wall -Wmissing-prototypes -Wmissing-declarations 
-I/local/src/postgresql-7.0/src/interfaces/libpq \
-I/local/src/postgresql-7.0/src/include -fpic -DPIC   -c -o \
XXX.o XXX.c

ld -x -shared -o XXX.so XXX.o
rm XXX.o
*/

#include 
#include "postgres.h"
#include "utils/builtins.h"

int am_int_bit_and(int, int);
int am_int_bit_or(int, int);
int am_int_bit_xor(int, int);
int am_int_bit_not(int);

/* $a & $b And Bits that are set in both $a and $b are set.  */
int am_int_bit_and(int arg1, int arg2)  {
return(arg1 & arg2);
}

/* $a | $b Or Bits that are set in either $a or $b are set.  */
int am_int_bit_or(int arg1, int arg2)  {
return(arg1 | arg2);
}

/* $a ^ $b Xor Bits that are set in $a or $b but not both are set.   */
int am_int_bit_xor(int arg1, int arg2)  {
return(arg1 ^ arg2);
}

/* ~ $a Not Bits that are set in $a are not set, and vice versa.   */
int am_int_bit_not(int arg1)  {
return(~ arg1);
}


DROP OPERATOR & (INT2, INT2);
DROP OPERATOR | (INT2, INT2);
DROP OPERATOR ^ (INT2, INT2);
DROP OPERATOR ~ (NONE, INT2);
DROP OPERATOR & (INT4, INT4);
DROP OPERATOR | (INT4, INT4);
DROP OPERATOR ^ (INT4, INT4);
DROP OPERATOR ~ (NONE, INT4);

DROP FUNCTION am_int_bit_and(INT2, INT2);
DROP FUNCTION am_int_bit_or(INT2, INT2);
DROP FUNCTION am_int_bit_xor(INT2, INT2);
DROP FUNCTION am_int_bit_not(INT2);
DROP FUNCTION am_int_bit_and(INT4, INT4);
DROP FUNCTION am_int_bit_or(INT4, INT4);
DROP FUNCTION am_int_bit_xor(INT4, INT4);
DROP FUNCTION am_int_bit_not(INT4);



CREATE FUNCTION am_int_bit_and(int2, int2) RETURNS int2
AS '/local/www/sites/odin/sql/int_bit_operators/am_int_bit_operators.so', 
'am_int_bit_and'
LANGUAGE 'C';

CREATE FUNCTION am_int_bit_or(int2, int2) RETURNS int2
AS '/local/www/sites/odin/sql/int_bit_operators/am_int_bit_operators.so', 
'am_int_bit_or'
LANGUAGE 'C';

CREATE FUNCTION am_int_bit_xor(int2, int2) RETURNS int2
AS '/local/www/sites/odin/sql/int_bit_operators/am_int_bit_operators.so', 
'am_int_bit_xor'
LANGUAGE 'C';

CREATE FUNCTION am_int_bit_not(int2) RETURNS int2
AS '/local/www/sites/odin/sql/int_bit_operators/am_int_bit_operators.so', 
'am_int_bit_not'
LANGUAGE 'C';



CREATE OPERATOR & (
LEFTARG = INT2,
RIGHTARG = INT2,
PROCEDURE = am_int_bit_and
);

CREATE OPERATOR | (
LEFTARG = INT2,
RIGHTARG = INT2,
PROCEDURE = am_int_bit_or
);

CREATE OPERATOR ^ (
LEFTARG = INT2,
RIGHTARG = INT2,
PROCEDURE = am_int_bit_xor
);

CREATE OPERATOR ~ (
RIGHTARG = INT2,
PROCEDURE = am_int_bit_not
);

-

DROP AGGREGATE am_abitor INT2;
DROP AGGREGATE am_abitand INT2;
DROP AGGREGATE am_abitxor INT2;

DROP AGGREGATE am_abitor INT4;
DROP AGGREGATE am_abitand INT4;
DROP AGGREGATE am_abitxor INT4;

CREATE AGGREGATE am_abitor ( BASETYPE = INT2, SFUNC1 = am_int_bit_or, STYPE1 = INT2);
CREAT

Re: [GENERAL] problem with subselect: NOT IN

2001-04-02 Thread Patrik Kudo

Hi

To start with, I think your queries will be faster if you don't use IN,
but instead used regular joins or EXISTS whenever possible

On Mon, 2 Apr 2001, Kevin L wrote:

> The following works fine: (get all employees who have sold
> something)
>
> SELECT emp_id FROM employee WHERE emp_id IN (SELECT emp_id FROM
> salesorder);

This will probably be faster like this:

SELECT DISTINCT e.emp_id FROM employee e, salesorder s WHERE e.emp_id =
s.emp_id;

Or, probably slower:

SELECT e.emp_id FROM employee e WHERE EXISTS (SELECT 1 FROM salesorder s
 WHERE e.emp_id = s.emp_id)

> However, getting employees who have NOT sold something always
> returns zero rows:
>
> SELECT emp_id FROM employee WHERE emp_id NOT IN (SELECT emp_id
> FROM workorder);

Hmm... That should work, but I noticed that in the first query
you use "salesorder" and in the second you use "workorder". Is that where
the fault is?

You might also want to try the following:

SELECT e.emp_id FROM employee e WHERE NOT EXISTS (SELECT 1 FROM salesorder s
  WHERE e.emp_id = s.emp_id)


Regards,
Patrik Kudo

> Has anyone encountered this before? I know the second query
> should return something because the data is in the table.
>
> thanks!
>
> -Kevin


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [GENERAL] problem with subselect: NOT IN

2001-04-02 Thread Peter Eisentraut

Kevin L writes:

> However, getting employees who have NOT sold something always
> returns zero rows:
>
> SELECT emp_id FROM employee WHERE emp_id NOT IN (SELECT emp_id
> >FROM workorder);

Are there any NULL values in workorder.emp_id?  If so, you need to exclude
them (... FROM workorder WHERE emp_id IS NOT NULL).

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


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [GENERAL] problem with subselect: NOT IN

2001-04-02 Thread Tom Lane

Kevin L <[EMAIL PROTECTED]> writes:
> However, getting employees who have NOT sold something always
> returns zero rows:
> SELECT emp_id FROM employee WHERE emp_id NOT IN (SELECT emp_id
> FROM workorder);

Probably you have some NULL values in workorder.  See past discussions
about why NOT IN and NULL don't get along very well (it's not a bug).

regards, tom lane

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



[GENERAL] reindexing sequences

2001-04-02 Thread mike




is there a way to reindex a sequence?
if so how and is it in the curent 
docs?
 
Mike


Re: [GENERAL] What could be the reason for EXTREMELY slow INSERTs?

2001-04-02 Thread Richard Huxton

Daniel ?erud wrote:
> 
> 1 inserts takes 665 seconds on the PIII 533, while on
> the dual 400 it takes about 13 seconds (*GULP!*). I have
> done a clean reinstallation (dpkg --purge postgresql, apt-
> get install postgresql) and tried it again. Same results.
> Do you guys know what could be the reason?

Are you running the same version on each machine? There was a discussion
recently where the first thousand inserts were very fast, the next
thousand fast, the next thousand acceptable...  until it grinds to a halt.

I think it was patched before 7.1RC1 - check the list archives for
details on the discussion.

Oh - you don't have constraints on the one but not the other, do you?

- Richard Huxton

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [GENERAL] reindexing sequences

2001-04-02 Thread Tom Lane

"mike" <[EMAIL PROTECTED]> writes:
> is there a way to reindex a sequence?

Sequences don't have indexes, so they don't need reindexing.

regards, tom lane

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [GENERAL] compile error

2001-04-02 Thread Soma Interesting

At 11:03 AM 4/2/2001 -0700, you wrote:
>linking ./include/port to interfaces/odbc/port
>mkdir: cannot create directory `interfaces/odbc': No such file or directory
>ln: ./include/port: hard link not allowed for directory
>configure: error: can not link interfaces/odbc/port to ./include/port

Ok, that error was because I'd only installed postgres from the base 
archive. Silly me.

However this error... who knows

Pg.xs: In function `XS_Pg_PQprint':
Pg.xs:584: `na' undeclared (first use in this function)
Pg.xs:584: (Each undeclared identifier is reported only once
Pg.xs:584: for each function it appears in.)
Pg.xs: In function `XS_PG_results_fetchrow':
Pg.xs:1255: `sv_undef' undeclared (first use in this function)
Pg.xs: In function `XS_PG_results_print':
Pg.xs:1295: `na' undeclared (first use in this function)
make[2]: *** [Pg.o] Error 1
make[2]: Leaving directory `/home/dfunct/postgresql-7.0.3/src/interfaces/perl5'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/dfunct/postgresql-7.0.3/src/interfaces'
make: *** [all] Error 2

Judging by the mailing list archives, lots of people have ran into this, 
but none received answers. (why is it searching the mailing list on 
anything 75% of the time returns multiple people asking the same thing with 
no answers in the thread?).


---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



Re: [GENERAL] Cascading deletes with rules in 7.0.3: why doesn't this work?

2001-04-02 Thread Jeremy Radlow

Thanks for the insight.  The problem is that logging ax is basically a
convenience for the end user.  (A is a user table)  I must reference B
from C.  If I also add an A reference to C, I want the A reference to
be automatically maintained at the database level.  And this is where
things start getting really convoluted...

I create a real C (c_real) and a view (c):

create table c_real (
 cx serial,
 bx int references b on delete cascade,
 ax int references a,
 primary key (cx)
);

create view c as select * from c_real;

Then I add rules to make c masquerade as a real table which supports
inserts/deletes/updates.  And the insert rule changes ax:

create rule c_insert as
on insert to c do instead
insert into c_real values (new.cx, new.bx,
 (select ax from b where b.bx = new.bx) );

Then there would be a trigger in B to change C whenever B's reference
to A changes.

I hope there's a simpler solution!

-Jeremy

At 11:52 AM 4/2/01 -0400, Tom Lane wrote:
>there's no bug.  The problem is the weird way you defined the
>c_delete rule:
>
>create rule c_delete as
>on delete to c do
> insert into delete_log (ax)
>values ((select ax from b where b.bx = old.bx));
>
>This depends on the assumption that there will be an entry in b that
>matches the bx value of the c row being deleted.  Unfortunately, when
>this delete is fired from an ON CASCADE DELETE from table b, the
>relevant row of b is already gone (as far as this transaction is
>concerned, anyway).  So the subselect yields no rows and you end up
>trying to insert a null into delete_log.
>
>Seems to me you want to record the A reference value directly in rows
>of C, so that C's delete rule can look the same as B's.


---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [GENERAL] compile error

2001-04-02 Thread Tom Lane

Soma Interesting <[EMAIL PROTECTED]> writes:
> Judging by the mailing list archives, lots of people have ran into this, 
> but none received answers.

You must not have looked in the right threads.

If you're building interfaces/perl5 by hand (ie, not letting
src/interfaces/Makefile do it for you) then you need to say

perl Makefile.PL POLLUTE=1

which is what the Makefile does (at least in recent releases).

This is fixed in 7.1, but earlier releases need the "POLLUTE=1".

regards, tom lane

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



[GENERAL] Interval representation?

2001-04-02 Thread Alvaro Herrera

Hi guys -

This is today's CVS:

db=> select 1::interval;
ERROR:  Bad interval external representation '1'

And this is 7.0.3:

db=> select 1::interval;
 ?column?
--
 00:00:01
(1 row)

Am I missing something?

-- 
Alvaro Herrera ()



---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



[GENERAL] How to display constraints?

2001-04-02 Thread Stephen Davies

The searchable archives seem to be unavailable today. Could somebody 
please tell me how to display the constraints that have been defined 
for a given table (or all tables). 

Is it possible to dump the original SQL DDL for a database or table? 
That is, not just the \d information but the actual SQL create table 
etc syntax?

Cheers and thanks,
Stephen Davies


Stephen Davies Consulting  [EMAIL PROTECTED]
Adelaide, South Australia. Voice: 08-8177 1595
Computing & Network solutions. Fax: 08-8177 0133



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [GENERAL] compile error

2001-04-02 Thread Soma Interesting

At 06:38 PM 4/2/2001 -0400, you wrote:
>Soma Interesting <[EMAIL PROTECTED]> writes:
> > Judging by the mailing list archives, lots of people have ran into this,
> > but none received answers.
>
>You must not have looked in the right threads.
>
>If you're building interfaces/perl5 by hand (ie, not letting
>src/interfaces/Makefile do it for you) then you need to say
>
> perl Makefile.PL POLLUTE=1
>
>which is what the Makefile does (at least in recent releases).
>
>This is fixed in 7.1, but earlier releases need the "POLLUTE=1".
>
> regards, tom lane

Thanks, Tom. One last hurdle (yeah right),

I copied plperl.so into the same folder as plpgsql.so (/usr/lib/pgsql/lib). 
Then ran createlang --PGLIB=/usr/lib/pgsql/lib plperl database_name and got 
no errors.

I then wrote a hello world plperl function and called it but got this error:

ERROR:  Load of file /usr/lib/pgsql/lib/plperl.so failed: libperl.so: 
cannot open shared object file: No such file or directory.


---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



Re: [GENERAL] compile error

2001-04-02 Thread Tom Lane

Soma Interesting <[EMAIL PROTECTED]> writes:
> ERROR:  Load of file /usr/lib/pgsql/lib/plperl.so failed: libperl.so: 
> cannot open shared object file: No such file or directory.

Is libperl.so known to your dynamic linker?  It has to be found via
LD_LIBRARY_PATH, /etc/ld.so.conf, or local equivalent.

regards, tom lane

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



RE: [GENERAL] Log file to sql database

2001-04-02 Thread Joseph

I would like to log cisco pix entries and then use that to report on
intrusion activities and monitor traffic patterns.

respectfully,
Joseph

-Original Message-
From: Ben [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 02, 2001 11:22 AM
To: Joseph
Cc: [EMAIL PROTECTED]
Subject: Re: [GENERAL] Log file to sql database


What kind of logs are you trying to dump to postgres? I recently used
firelogd to enter logs for iptables-based firewalls, and it's working
great.

On Mon, 2 Apr 2001, Joseph wrote:

>
> Anyone care to share suggestions on getting data from a running syslog
into
> postgresql database?
>
>
> respectfully,
> Joseph
>
>
> ---(end of broadcast)---
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
>


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



RE: [GENERAL] Log file to sql database

2001-04-02 Thread Joseph

Thanks for the great anwsers.
I recieved good answers.

I had not even started thinking about the normalization part of it yet.

I am not sure I understand the implications of the piping it to the insert
routine.
That sure would sound like a simple effective method.


respectfully,
Joseph

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of KuroiNeko
> Sent: Monday, April 02, 2001 9:10 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [GENERAL] Log file to sql database
>
>
> > Anyone care  to share suggestions on  getting data from a  running
> syslog
> > into
> > postgresql database?
>
>  One way would be adding something like this to syslog.conf:
>
> . |/path/to/insert/routine
>
>  However  that  might  impose  unwanted burden.  Also,  IIRC  syslog
> keeps
> `routine' loaded so making sure it doesn't waste precious cycles while
> idle
> is up  to you.  This pipe would  be always ready  for reading,  so
> select()
> might fail to work as desired.
>  Another approach is to enhance log  rotation program to add the records
> to
> the database. Depends on log rotation program :)
>  YMMV, as always and good DB design for syslog is yet to be developed
> IMHO.
> On one hand it has to be normalised enough to eliminate repetitions, on
> the
> other hand,  it needs  to be  simple and flexible  to be  able to  adopt
> to
> various not-so-standard programs that use syslog.
>  At least,  facility, priority, timestamp,  hostname and process  (name
> and
> PID) are quite common.
>
>
> --
>
>  LD$/G-$OAM$rJa$i$L
>
>
> ---(end of broadcast)---
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to [EMAIL PROTECTED] so that your
> message can get through to the mailing list cleanly
>


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



RE: [GENERAL] Log file to sql database

2001-04-02 Thread KuroiNeko

> I am  not sure  I understand  the implications  of the  piping it  to the
> insert
> routine.

 It's a double-edged sword. Invoking it is  as simple as adding a line to a
conf file,  while developing it  may turn out to  be tricky. At  least make
sure you examine output of ps ax to see how much CPU time it uses.
 And if  you pipe  it to a  script, you'll have  an interpreter  loaded and
sitting there wasting your RAM.


--

 ÌĤ¯Ç­¤ÏÁͤòÊá¤é¤Ì


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [GENERAL] Log file to sql database

2001-04-02 Thread Doug McNaught

KuroiNeko <[EMAIL PROTECTED]> writes:

> > I am  not sure  I understand  the implications  of the  piping it  to the
> > insert
> > routine.
> 
>  It's a double-edged sword. Invoking it is  as simple as adding a line to a
> conf file,  while developing it  may turn out to  be tricky. At  least make
> sure you examine output of ps ax to see how much CPU time it uses.
>  And if  you pipe  it to a  script, you'll have  an interpreter  loaded and
> sitting there wasting your RAM.

Also, if your pipe reader slows down too much, syslogd will start
blocking on the pipe, which will slow down the whole system (syslogd
generally isn't multi-threaded).  So I think it'd be much safer to
have a flat text logfile and have your program read from that (using
similar code to 'tail -f', as was suggested earlier).  That way if you
fall behind during a busy period you can catch up once things ease up, 
and syslogd doesn't kill your whole system.

As for the interpreter issue, well, I'd rather spend the memory and
use a language that is designed for string-slinging.  Using Perl or
Python to parse things is *so* much easier than C (even with a good
regex library available).

As always, just MHO...

-Doug

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



Re: [GENERAL] Log file to sql database

2001-04-02 Thread KuroiNeko

> Also, if your pipe reader slows down too much, syslogd will start
> blocking on the pipe

 Indeed.

> So I think it'd be much safer to
> have a flat text logfile and have your program read from that

 Or send the data to DB backend only when the logs are rotated. As long
as the logs are kept short, grep'ing should be enough.

> As for the interpreter issue, well, I'd rather spend the memory and
> use a language that is designed for string-slinging.

 Depends on revenue/RAM price ratio :)

> Using Perl or
> Python to parse things is *so* much easier than C (even with a good
> regex library available).

 Well, regex is simple, just 4 functions. It doesn't do replacements but
that's not what one needs in this case. But this is off-topic, anyway.


--

 ÌĤ¯Ç­¤ÏÁͤòÊá¤é¤Ì


---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [GENERAL] reindexing sequences

2001-04-02 Thread Richard Huxton

From: "mike" <[EMAIL PROTECTED]>

is there a way to reindex a sequence?
if so how and is it in the curent docs?

Mike


Reindex a sequence? Not sure what you mean by that. You can set the value to
something else:

select setval('mysequence',12345);

If you mean compact the values used so there aren't any gaps in the
sequence - no there's nothing that does that. There's not really any way for
Postgres to know what you've done with the sequence values.

- Richard Huxton


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]