RE: [SQL] Temp tables being written to disk. Avoidable?

2001-08-14 Thread Paul McGarry
Hi Tom, Thanks for your response, enlightening as always. > Not at present --- temp tables are not different from real tables, > except for some naming shenanigans. So creation of a temp table will > involve some disk hits. Ok, would it be a good idea to modify that for the future? Given that

Re: [SQL] result sets from functions...

2001-08-14 Thread Jan Wieck
Josh Berkus wrote: > Robert, > > > i'm reading the postgres documentation and i'm specifically > > interested in creating stored procedures so that i can keep > > as much of the business logic in the database as possible. > > while reading 13.1.3 (SQL Functions on Composite Types) in > > the Progr

[SQL] Re: DateDiff, IsNull?

2001-08-14 Thread Bill
IsNull work like this SELECT IsNull( user_name, '') FROM user ; then the query will return empty string when the field user_name is null Regards Bill > > Hello all, > > > > I am a newbie to postgreSQL, is it possible to write a "DateDiff", > > "IsNull" function work same as the one in SQL Se

Re: [SQL] result sets from functions...

2001-08-14 Thread Josh Berkus
Robert, > i'm reading the postgres documentation and i'm specifically > interested in creating stored procedures so that i can keep > as much of the business logic in the database as possible. > while reading 13.1.3 (SQL Functions on Composite Types) in > the Programmer's Guide i come across the

[SQL] result sets from functions...

2001-08-14 Thread Robert J. Sanford, Jr.
i'm reading the postgres documentation and i'm specifically interested in creating stored procedures so that i can keep as much of the business logic in the database as possible. while reading 13.1.3 (SQL Functions on Composite Types) in the Programmer's Guide i come across the phrase... "When

[SQL] Temp tables being written to disk. Avoidable?

2001-08-14 Thread Paul McGarry
Hi, I have an application where I am using fulltextindex to create a searchable index for a table and wish to return pages of results, ranked in order of relevance. So for any particular page view I need to know: a) Total number of results relevant to search (so I can display page [1] 2 3 4 5

Re: [SQL] psql connection being reset during function?

2001-08-14 Thread Tom Lane
Randall Skelton <[EMAIL PROTECTED]> writes: > problem #2: While this works perfectly for a small table of 10 entries, it > crashes the database connection when I try to update 311537 rows In present releases, plpgsql tends to leak a lot of memory intra-call; you're probably just running out of me

Re: [SQL] Deadlocks? What happened to MVCC?

2001-08-14 Thread Josh Berkus
Tom, Jan, > MVCC does not mean "no locks" ... particularly not when UPDATEs are > involved. You'll need to be more specific about what your function > is > doing, but my first thought would be to look for the possibility of > conflicting updates of the same row. Found the problem after 3 hours

Re: [SQL] Deadlocks? What happened to MVCC?

2001-08-14 Thread Tom Lane
MVCC does not mean "no locks" ... particularly not when UPDATEs are involved. You'll need to be more specific about what your function is doing, but my first thought would be to look for the possibility of conflicting updates of the same row. regards, tom lane --

[SQL] psql connection being reset during function?

2001-08-14 Thread Randall Skelton
Hi all, I am running 7.1.2 and I have the unenviable task of cleaning up a database which has columns: sgmty integer, -- YEAR sgmtmo integer, -- MONTH sgmtd integer, -- DAY sgmth integer, -- HOUR sgmtm integer, -- MINUTE sgmts float, -- SECOND + 190 other floats per row The d

Re: [SQL] Date: the day before yesterday.

2001-08-14 Thread Jan Wieck
Jason wrote: > I am trying to retrieve records generated in the passed two days and > encountered difficulties in dealing with the date in Oracle. > Here is the query I try to form: > > select * from Table where InputDate>=[the day before yesterday] > > I tried "sysdate-2", didn't work. > Any sugg

Re: [SQL] Deadlocks? What happened to MVCC?

2001-08-14 Thread Jan Wieck
Josh Berkus wrote: > Folks: > > I'm getting deadlock errors on one of the operations on my web > application. It's a function which adds a large number of rows to a > holding table, then updates that set of rows multiple times in order to > present scoring information to the user. > > However, th

Re: [SQL] Re: Are circular REFERENCES possible ?

2001-08-14 Thread Gary Stainburn
Hi Mike, A few people have suggested this, but the thing I don't like (and I think at some point William has also stated this) is that doing it this way, you lose the logic (and the purity) of the data. If you allow the cyclic reference, then the data behaves -and looks - exactly as it should

[SQL] Deadlocks? What happened to MVCC?

2001-08-14 Thread Josh Berkus
Folks: I'm getting deadlock errors on one of the operations on my web application. It's a function which adds a large number of rows to a holding table, then updates that set of rows multiple times in order to present scoring information to the user. However, the function is deadlocking itself

Re: [SQL] DateDiff, IsNull?

2001-08-14 Thread Josh Berkus
Bill, > I am a newbie to postgreSQL, is it possible to write a "DateDiff", > "IsNull" function work same as the one in SQL Server and are there > and > sample out there? I take it that you want to do this to port an exisiting application? If so, the DateDiff thing has already been covered in

[SQL] Re: the day before yesterday.

2001-08-14 Thread Carl Karsten
I am not sure if this will work with Oracle. I would like to know, so if you could try out this test : http://www.foxforum.com/showfullmessage.cfm?messageID=12382 If it does work, then you should be able to do this: ldDby = date()-2 lnRet = sqlexec( h, "select * from Table where InputDate>=?ldD

[SQL] Date: the day before yesterday.

2001-08-14 Thread Jason
I am trying to retrieve records generated in the passed two days and encountered difficulties in dealing with the date in Oracle. Here is the query I try to form: select * from Table where InputDate>=[the day before yesterday] I tried "sysdate-2", didn't work. Any suggestions? Thanks! Jason

Re: [SQL] Eh?

2001-08-14 Thread Tom Lane
Tod McQuillin <[EMAIL PROTECTED]> writes: > This makes me wonder... in the case of a stored complex view, would it be > helpful to ask PostgreSQL to spend extra time in query optimisation and > then cache the result? Or does it do this already? I don't see any value in caching plans for views as

[SQL] how to use record type

2001-08-14 Thread Horst Herb
Help please! How do I actually insert the variables OLD or NEW or a record type into a table from within a trigger? Like doing the following: drop table th1; create table th1( id serial, text text ); drop table th_audit; create table th1_audit( ts timestamp default now() ) inherits(th1); dr

Re: [SQL] Re: DateDiff, IsNull?

2001-08-14 Thread Tom Lane
Alan Gutierrez <[EMAIL PROTECTED]> writes: > On Tue, 14 Aug 2001, Bill wrote: >> And is it possible to override the existing function and >> operator like "+" to become a concate? > Overloading operators? *Please* tell me that this is impossible. I've got bad news ;-) ... it's pretty easy. regr

Re: [SQL] create function using language SQL

2001-08-14 Thread Tom Lane
Gary Stainburn <[EMAIL PROTECTED]> writes: > ... However, I cannot find the > syntax to create a function in SQL. Specifically, how you return the result. See http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/xfunc.html#XFUNC-SQL regards, tom lane ---

[SQL] Re: [NOVICE] Arithmetic operation on DATE

2001-08-14 Thread Jason Wong
I know you can do it for days, thus: expires = CURRENT_TIMESTAMP + 10 would be 10 days from now. Don't know about months though. HTH -- Jason Wong Gremlins Associates www.gremlins.com.hk - Original Message - From: macky <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECT

[SQL] Re: create function using language SQL

2001-08-14 Thread Jeff Eckermann
The "create function" syntax is the same. The language syntax is straight SQL: CREATE FUNCTION getteamno(int4) RETURNS varchar AS ' SELECT tregion || ''/'' || to_char(tnumber, ''FM000'') FROM teams WHERE tid = $1 ' LANGUAGE 'sql'; You don't get to build in error checking, but there has to be a

RE: [SQL] Re: Are circular REFERENCES possible ?

2001-08-14 Thread Michael Ansley (UK)
Title: RE: [SQL] Re: Are circular REFERENCES possible ? -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 The easiest way out is probably to create a relationship entity called 'default' between customer and shop for the default relationship.  This way you only have to have one direct relationsh

[SQL] Re: [GENERAL] Re: Mirroring the database?

2001-08-14 Thread Justin Clift
There's also PostgreSQL Replicator (which I haven't gotten around to trying) : http://pgreplicator.sourceforge.net :-) Regards and best wishes, Justin Clift Allan Engelhardt wrote: > > Ehhh, use dual-ported RAID disks? (Well, tri-port in your case, but maybe A and B >machines are enough.

[SQL] problem connecting to pg.

2001-08-14 Thread postgresql
I am experimenting with running PG 7.1.2 on Mac OSX. I seem to have a problem with getting my users to connect. This works beautifully when connect to my linux box. Any ideas? [localhost:/etc] postgres% /usr/local/pgsql/bin/postmaster -i -p5444 -D /users/postgres/pgdata DEBUG: database sys

[SQL] deleting large objects from jdbc

2001-08-14 Thread heatherm
Hi, I've been browsing the newsgroup archives and came across the following: > > > > > Can you see a scenario where a programmer would forget to delete the > > > > > data from pg_largeobject and the database becoming very large filled > > > > > with orphaned large objects? Does this mean that

[SQL] Where is pgplsql.so located in 7.1.2?

2001-08-14 Thread Raymond Chui
When I do createlang -U postgres -d mydbname pgplsql mydbname I got can't find /usr/share/pgsql/plpgsql.so error message. But there is no plpgsql.so file in /usr/share/pgsql directory! I just installed RPM binary 7.1.2 for Redhat 6.2 In 7.0 the pgplsql.so file is located in /usr/lib/pgsql/ So

[SQL] Re: on update restrict

2001-08-14 Thread Alan Gutierrez
On Tue, 14 Aug 2001, Jan Wieck wrote: > Mister ics wrote: > > testdb=>create table t1 ( > >id int primary key, > >foo int); > > testdb=>create table t2 ( > >id int primary key, > >ref int references t1(id) on update restrict); > So an attempt to > > UPDATE t1 SET id

[SQL] The numbers are not match in 7.1.2

2001-08-14 Thread Raymond Chui
When I do select * from pg_database; I got datname | ... | datlastsysoid mydbname | ... | 18539 But When I cd $PGDATA/data/base/ ls -la I got 1 18719 18725 Where is 18539 ??!! I think mydbname is 18725 When I cd 18725 ls There are

[SQL] Re: Are circular REFERENCES possible ?

2001-08-14 Thread William Courtier
I denis, I don't know if you can use a circular REFERENCES, but why you try made a references before the table is created (customers). You should create the references after and use the foreign key if circular references does not work. William "Denis Bucher" <[EMAIL PROTECTED]> a écrit dans le m

[SQL] create function using language SQL

2001-08-14 Thread Gary Stainburn
Hi all, As I was reading up on create function etc. while learning plpgsql, I seam to remember it stated that as well as plpgsql, that other languages are/will be available including using SQL as the language. However, I cannot find the syntax to create a function in SQL. Specifically, how y

Re: [SQL] on update restrict

2001-08-14 Thread Jan Wieck
Mister ics wrote: > Hi, > > I'm a little confused by the "on update restrict" option in a referential > integrity constraint. I don't know if i have not understood the meaning of > this statement or it does not work properly. > I think that if it is specified ON UPDATE RESTRICT in a foreign key >

[SQL] on update restrict

2001-08-14 Thread Mister ics
Hi, I'm a little confused by the "on update restrict" option in a referential integrity constraint. I don't know if i have not understood the meaning of this statement or it does not work properly. I think that if it is specified ON UPDATE RESTRICT in a foreign key costraint, the sql-server sh

[SQL] DateDiff, IsNull?

2001-08-14 Thread Bill
Hello all, I am a newbie to postgreSQL, is it possible to write a "DateDiff", "IsNull" function work same as the one in SQL Server and are there and sample out there? And is it possible to override the existing function and operator like "+" to become a concate? Regards Bill ---