Re: [SQL] View performance question

2001-06-22 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> writes: > I tried re-arranging the JOINS as you suggested. There was no impact on > gross performance (still 42 seconds to return the first row). And yes, > it is the classic "star" database. > What follows is the query plan. Hm. The query plan looks very rea

Re: [SQL] distinguishing different database connections

2001-06-22 Thread Stephan Szabo
How about creating a temporary table with the data? That'll be persistant for the session. On Fri, 22 Jun 2001, Markus Wagner wrote: > Hi, > > can I access information on the current connection from within a trigger > function? > I need to identify different server connections somehow. Someth

Re: [SQL] What is a "tuple"

2001-06-22 Thread Ross J. Reedstrom
On Fri, Jun 22, 2001 at 06:31:03PM +0200, Kristoff Bonne wrote: > Greetings, (and also Alex) > > On Fri, 22 Jun 2001, Josh Berkus wrote: > > > Excuse my lack my 'database'-jargon, but what is a 'tuple'? > > > Also known as a "Record", or a "Row". The word "tuple" is used because > > it can refe

[SQL] timestamp conversion to unisgned long?

2001-06-22 Thread pierre
All, Perhaps I'm not sing hte correct datatype, but I'd like to be able to convert a timestamp over to an unsigned long to be used within C code and compare to the output of time(). I can't seem to see any easy way of doing this using the built in stuff for postgresql. Ideas? Perhaps I'

Re: [SQL] View performance question

2001-06-22 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> writes: > I can't figure out how to get Explain to output to a file instead of the > screen. Embarassing, I know, but the command seems to subbornly resist > all command-line re-direction. I think that in psql, EXPLAIN results (and notices in general) come out v

[SQL] unregister

2001-06-22 Thread Porfirio Córdoba
unregister   Please don´t send more information about you.

Re: [SQL] Incremental sum ?

2001-06-22 Thread Ross J. Reedstrom
On Fri, Jun 22, 2001 at 12:58:46PM -0400, Tom Lane wrote: > "Ross J. Reedstrom" <[EMAIL PROTECTED]> writes: > > And here's the working example: not the need to GROUP BY, and <= > > to get the current payment. > > > select cust_id,invoice_id,val,paid, (select (sum(val) - sum(paid)) > > from inv

Re: [SQL] View performance question

2001-06-22 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> writes: > I created a view to support comprehensive reporting on one of the > databases I work with. Unfortunately, due to the structure of the > database, which includes 25 reference tables, this requires 3 regular > joins and about 40 LEFT OUTER JOINS, outputti

Re: [SQL] Incremental sum ?

2001-06-22 Thread Tom Lane
"Ross J. Reedstrom" <[EMAIL PROTECTED]> writes: > And here's the working example: not the need to GROUP BY, and <= > to get the current payment. > select cust_id,invoice_id,val,paid, (select (sum(val) - sum(paid)) > from invoices_not_paid where cust_id= i.cust_id and invoice_id <= > i.invoice_id

Re: [SQL] Incremental sum ?

2001-06-22 Thread Ross J. Reedstrom
And here's the working example: not the need to GROUP BY, and <= to get the current payment. select cust_id,invoice_id,val,paid, (select (sum(val) - sum(paid)) from invoices_not_paid where cust_id= i.cust_id and invoice_id <= i.invoice_id group by cust_id) as balance from invoices_not_paid i; a

Re: [SQL] What is a "tuple"

2001-06-22 Thread Kristoff Bonne
Greetings, (and also Alex) On Fri, 22 Jun 2001, Josh Berkus wrote: > > Excuse my lack my 'database'-jargon, but what is a 'tuple'? > Also known as a "Record", or a "Row". The word "tuple" is used because > it can refer to a row returned as part of a result set as well as a > record in a table.

[SQL] cache lookup failed ???? What is it ???!!!

2001-06-22 Thread J.Fernando Moyano
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I can't execute this SQL query: DELETE FROM piezas WHERE ord_mec = '01-001' I get: ERROR: fmgr_info: function 39816: cache lookup failed Can someone help me with this error ?? ** CREATE TABLE

Re: [SQL] Re: Re: binary data

2001-06-22 Thread Tom Lane
Karel Zak <[EMAIL PROTECTED]> writes: > On Fri, Jun 22, 2001 at 10:22:32AM -0400, Tom Lane wrote: >> He did say the rules for escaping things are tricky ;-). > And what use some better encoding if you have a lot of binary chars > in data. For example base64, that code 2 chars to 3 instead \\000

Re: [SQL] firehouse

2001-06-22 Thread Ross J. Reedstrom
On Wed, Jun 20, 2001 at 07:37:39PM +, sbelow wrote: > getting this error "Transaction cannot start while in firehouse mode." I > can't find in the books what this is trying to tell me. > new at dbs. That message is not coming from PostgreSQL, I've grepped the source tree: $ find . -name \*.[

Re: [SQL] Re: Re: binary data

2001-06-22 Thread Karel Zak
On Fri, Jun 22, 2001 at 10:22:32AM -0400, Tom Lane wrote: > He did say the rules for escaping things are tricky ;-). You need to > double the backslashes, because interpretation of the string literal > takes off one level of backslashing before bytea ever sees it: > > regression=# INSERT INTO l

Re: [SQL] Help with a double left join

2001-06-22 Thread Tom Lane
"Ari Nepon" <[EMAIL PROTECTED]> writes: > Thanks Alex. But it was too good to be true. Or, more likely, I did > something else wrong. clients.ID => client.ID, likely. regression=# create table track(project int, client int); CREATE regression=# create table project(project_id int); CREATE regres

Re: [SQL] Re: Re: binary data

2001-06-22 Thread Tom Lane
"Hugh Mandeville" <[EMAIL PROTECTED]> writes: > "Alex Pilosov" <[EMAIL PROTECTED]> wrote in message >> The rules for escaping things you want to throw at it are tricky though. >> (and same for unescaping things you get back from database). > test=# INSERT INTO log (data) VALUES ('special chars \n

Re: [SQL] select tbl1.attr1, number of tuples where tbl2.attr1=tbl1.attr1

2001-06-22 Thread Tom Lane
"Markus Bertheau" <[EMAIL PROTECTED]> writes: > Then i tried > select partners.person_id, count(views.person_id) from partners, views where >views.person_id = partners.person_id group by views.person_id > but this gave very strange results which are definitely not what i wanted. I think you mis

RE: [SQL] Help with a double left join

2001-06-22 Thread Ari Nepon
Thanks Alex. But it was too good to be true. Or, more likely, I did something else wrong. I am still getting this error: Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'track.project=projec

[SQL] What is a "tuple"

2001-06-22 Thread Kristoff Bonne
Greetings, I've been on this list for just a couple of days now; and I've seen the word 'tuple' here a couple of times. Excuse my lack my 'database'-jargon, but what is a 'tuple'? Cheerio! Kr. Bonne. -- KB905-RIPE Belgacom IP networking (c=be,a=rtt,p=belg

RE: [SQL] Difference between insert a tuple in a table by function and by datasheet

2001-06-22 Thread Cyril Slucki
REMOVE -Message d'origine-De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]De la part de DI HasenöhrlEnvoyé : vendredi 22 juin 2001 09:23À : [EMAIL PROTECTED]; [EMAIL PROTECTED]Objet : [SQL] Difference between insert a tuple in a table by function and by datasheet Hi,

[SQL] Help with a double left join

2001-06-22 Thread Ari Nepon
I am trying to do a left join FROM [a table with two columns that have foreign IDs] LEFT JOIN [two other tables, each has a unique ID]. I have the left join working where I join only two tables (not three): SELECT track.ID, track.employee, track.client, track.task, track.description, track.hours

Re: [SQL] set datestyle to European PROBLEM

2001-06-22 Thread Roelof Sondaar
Hello Alessandro, The manual I have says the following about Date/Time Styles: - 4 styles (ISO-8601, SQL, Postgres, German) The one which resembles your layout is German. I looked it up in Bruce Momjians book. Best regards, Roelof Alessandro Rossi schreef: > > I have the defaul installation o

[SQL] constraints,

2001-06-22 Thread jeff
Hello folks, wondering how to display any constraints that a table may have, as well i know alter table add constraint works, but what's the syntax to remove one ? i assume /alter table remove constraint, but i can't find any examples. jeff ---(end of broadcast)--

[SQL] select tbl1.attr1, number of tuples where tbl2.attr1=tbl1.attr1

2001-06-22 Thread Markus Bertheau
Hey, I have three tables. table persons { login, person_id UNIQUE } table views { person_id, timestamp } table partners { person_id UNIQUE, domain } for each tuple in partners i want to know the number of tuples in views with the same person_id. I tried sth like select par

Re: [SQL] distinguishing different database connections

2001-06-22 Thread Alex Pilosov
You can use backend's PID from a trigger, it is unique. On Fri, 22 Jun 2001, Markus Wagner wrote: > Hi, > > can I access information on the current connection from within a trigger > function? > I need to identify different server connections somehow. Something like > a "connection id" would be

[SQL] CAST Problem: Difference between insert a tuple in a table by function and by datasheet

2001-06-22 Thread DI Hasenöhrl
Now,I found the problem, but I don't know how to solve. It depends on type float8. I changed all type float to float8   In my function I make the following calculation: . update KalkPreislisten_float8 SET  kp_ep = rkontingent.k_ep::float8    -- this works correct   but I hav

[SQL] Dump db with LO

2001-06-22 Thread vincent
Hello. I wonder if someone could give me a tip how should I dump db with LO. I use pg_dump and pg_dumpall and evrything is dumped but not LO. What should I do with that. I will be very greatful fot answer. P.S. Sorry for my english ;) Mateusz Mazur [EMAIL PROTECTED] POLAND

[SQL] distinguishing different database connections

2001-06-22 Thread Markus Wagner
Hi, can I access information on the current connection from within a trigger function? I need to identify different server connections somehow. Something like a "connection id" would be enough. The background: When a user starts a frontend application (NT, Access) he starts a new connection to

[SQL] Difference between insert a tuple in a table by function and by datasheet

2001-06-22 Thread DI Hasenöhrl
Hi,   this is my 2nd attempt to get some links for my problem. I don't know whether my question is so stupid or difficult or I'm in the wrong list. Please let me know.   I have the following situation: ( I use MsAccess97 as frontend, ODBC 7.1.0003) I insert tuples in a table with a plpgsql-fu

Re: [SQL] Changing PL/pgSQL triggers

2001-06-22 Thread Kristoff Bonne
Greetings, On Thu, 21 Jun 2001, Josh Berkus wrote: >> What's the easiest way to modify or view a function written in >> PL/pgSQL? I've been using pg_dump to get the original function, then >> dropping and creating the function and trigger after making a change. >> Is there an easier way? > Well