Re: [SQL] Out of free buffers... HELP!

2001-09-19 Thread Josh Berkus
Mike, > I recently lost a hard drive and had to re-install, so the PG version > I am > using is only about 3 weeks old. However, as I said in my original > post, I > have A LOT of data in this database. Brick* implies 1334 tables, > some of > which have 2.5M records... All told, I have about 3

Re: [SQL] Out of free buffers... HELP!

2001-09-19 Thread Tom Lane
"Diehl, Jeffrey" <[EMAIL PROTECTED]> writes: > Brick* implies 1334 tables Hmm ... I wonder if the query is somehow holding onto a buffer pin for the last block of each successively-accessed table? Will look into it. What -B (# of shared buffers) setting are you running the postmaster with? Try

Re: [SQL] Holiday Calculations?

2001-09-19 Thread clayton cottingham
clayton cottingham wrote: > > Brett Schwarz wrote: > > > > I couldn't resist, so I went ahead and did all of them. I might be using > > these in a future app anyways. Again these are Tcl procs, but you may be > > able to transfer the logical to another language, if you want. > > > > if you need

Re: [SQL] Creating a boolean function

2001-09-19 Thread Kovacs Baldvin
> You need conditional logic, which suggests pl/pgsql is the way to go. Maybe he could use simple sql function like this: create function check_loan(text,int,int) returns boolean as ' select ( select count(*) from kolcsonok where code_user=($2) and code_loan=($3) and typet

Re: [SQL] Creating a boolean function

2001-09-19 Thread Tom Lane
=?iso-8859-1?Q?Miguel_Gonz=E1lez?= <[EMAIL PROTECTED]> writes: > But I got that the parser cannot identify the =$ operator You need a space between = and $. regards, tom lane ---(end of broadcast)--- TIP 2: you can get off

Re: [SQL] Out of free buffers... HELP!

2001-09-19 Thread Diehl, Jeffrey
Ok, can someone explain to me why this first query might run faster than the second? select src,dst,count(dst) from data; select src,dst,count(*) from data; I've always used the second form. If the first is faster, I need to know. Thanx, Mike Diehl, Network Monitoring Tool Devl. Sandia Nation

Re: [SQL] Out of free buffers... HELP!

2001-09-19 Thread Diehl, Jeffrey
I recently lost a hard drive and had to re-install, so the PG version I am using is only about 3 weeks old. However, as I said in my original post, I have A LOT of data in this database. Brick* implies 1334 tables, some of which have 2.5M records... All told, I have about 355G of data. I don't

Re: [SQL] Holiday Calculations?

2001-09-19 Thread clayton cottingham
Brett Schwarz wrote: > > I couldn't resist, so I went ahead and did all of them. I might be using > these in a future app anyways. Again these are Tcl procs, but you may be > able to transfer the logical to another language, if you want. > if you need this in perl i think Data::Manip might hep

Re: [SQL] Holiday Calculations?

2001-09-19 Thread Brett Schwarz
I couldn't resist, so I went ahead and did all of them. I might be using these in a future app anyways. Again these are Tcl procs, but you may be able to transfer the logical to another language, if you want.  proc getTG {year} { set di \ [clock format [clock scan $year-11-30] -fo

Re: [SQL] Creating a boolean function

2001-09-19 Thread Jeff Eckermann
Maybe the reason is that you defined the function to return bool, but are attempting to return text? You need conditional logic, which suggests pl/pgsql is the way to go. Something simple should do it, like: create function check_loan (text,int,int) returns bool as ' begin select * from loans whe

Re: [SQL] Creating a boolean function

2001-09-19 Thread Stephan Szabo
On Wed, 19 Sep 2001, [iso-8859-1] Miguel González wrote: > I tried > > create function check_loan (text,int,int) > returns bool > as > 'select CAST(typetable AS text) from loans where typetable=$1 and > code_user=$2 and code_loan=$3;' > language 'sql'; > > > But I got that the parser cannot id

[SQL] URGENT ! Nouveau virus

2001-09-19 Thread Denis Bucher
Hello ! Ok... I wrote a small text against that virus just in case you need it ! http://www.horus.ch/virus180901.txt A bientôt ! Denis Bucher ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscr

[SQL] Creating a boolean function

2001-09-19 Thread Miguel González
by the way you know how to create the following sql function? I need to return a boolean saying if an object is onloan. the loan table is as follows: loans - code_loan code_user typetable i want to check these three fields, the first two fields (the code ones) are integer and the last a s

Re: [SQL] Checking for table existence (fwd)

2001-09-19 Thread Kovacs Baldvin
Some of you may get this message for the second time, but as I see there is some problem with one particular mail server on the route, and this message didn't arrive back from the list despite the fact that I sent it several days ago. -- Subject: R

Re: [SQL] Stored prosedure last run

2001-09-19 Thread Josh Berkus
Pasha, > I'm trying to find if anyone knows how to find out when the stored > procedure was used last time (not created). If you want to do this, you'd need to create your own log table, and write to it at the beginning of your function: CREATE TABLE function_log ( run_id SERIAL NOT NULL PRI

Re: [SQL] PL/PGSQL Regexe

2001-09-19 Thread Tom Lane
rdear <[EMAIL PROTECTED]> writes: > I'm doing a check within a PL/PGSQL function using a regular expression > and I get the error: > ERROR: regcomp failed with error invalid character range > This appears to be because of the underscore "_" character. The regex I > want to use is ''[A-Za-z0-9

Re: [SQL] Registring a C function in PostgreSQL II

2001-09-19 Thread Haller Christoph
I'm working on a HP-UX system, so some of the following has to be adapted, but in principle it's the same on every system and it works. First piece of code is a standalone program, which you should always write and test before you start creating C functions inside PostgreSQL. Second piece is

[SQL] PL/PGSQL Regexe

2001-09-19 Thread rdear
I'm doing a check within a PL/PGSQL function using a regular expression and I get the error: ERROR: regcomp failed with error invalid character range This appears to be because of the underscore "_" character. The regex I want to use is ''[A-Za-z0-9_]'' but this doesn't work. Any suggestions

Re: [SQL] Registring a C function in PostgreSQL

2001-09-19 Thread Miguel González
Many thanks for your answers. The thing that in the Bruce´s book doesnt explain how to compile this kind of functions, anyway I found how to compile it. Now, I am still having problems. I want to create a function to send an email. I pass to the function two arguments: the email to send, and the

Re: [SQL] group by weirdness

2001-09-19 Thread Carl van Tast
On Sat, 15 Sep 2001 00:26:01 +0200, I wrote: > [...] >CREATE VIEW mj1 (jid, cnt) AS >SELECT jid, COUNT(mid) cnt FROM mj GROUP BY jid; This should be COUNT(mid) AS cnt ... > [...] >I did not test this with PostgreSQL, but you get the idea. Well, now I did test with PostgreSQL (thanks, Jason Tis

[SQL] Implicit v Explicit joins...

2001-09-19 Thread [EMAIL PROTECTED]
So I wasn't paying enough attention to postgres upgrades and missed that 7.1 actually has outer joins, so I'm currently happily rebuilding, but I had a few questions about the explicit join syntax and preformance issues. 1. Say i have a tables called "married" (marriedid, husband, wife), "peo

Re: [SQL] Registring a C function in PostgreSQL

2001-09-19 Thread Haller Christoph
Did you use the compiler option for generating position independent code (PIC) for use in building shared libraries. Did you use the linker option for creating a shared library - I think you did, the file suffix .so looks that way. I did it several times successfully using commands like CREA

Re: [SQL] Registring a C function in PostgreSQL

2001-09-19 Thread Peter Eisentraut
Miguel González writes: > ERROR:/load of file /home/postgres/ctof.so failed: /home/postgres/ctof.so > ELF file´s phentsize not the expected size. You probably didn't compile or link the code correctly. See the PostgreSQL Programmer's Guide for information. -- Peter Eisentraut [EMAIL PROTEC