Re: [SQL] Differentiate Between Zero-Length String and NULLColumn Values

2007-02-08 Thread Jan Wieck
On 1/30/2007 3:17 PM, Jamie A Lawrence wrote: Just a datapoint: SQL*Plus: Release 10.1.0.3.0 - Production on Tue Jan 30 15:15:49 2007 Copyright (c) 1982, 2004, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production With the Partition

Re: [SQL] Triggers

2005-11-29 Thread Jan Wieck
On 11/23/2005 3:44 AM, Achilleus Mantzios wrote: O Neil Saunders έγραψε στις Nov 22, 2005 : And change AFER INSERT to BEFORE INSERT 1) it doesnt make any difference since we are updating a different table than the trigger's one In this particular case it doesn't. In general, another BEFOR

Re: [SQL] why vacuum

2005-10-27 Thread Jan Wieck
On 10/27/2005 8:34 AM, Mario Splivalo wrote: Postgres itself offers no replication. Oracle itself offers no replication. IBM DB2 itself offers no replication. Yet most of the products out there for Oracle, DB2 and PostgreSQL are far better than what I read here: http://dev.mysql.com/do

Re: [SQL] why vacuum

2005-10-27 Thread Jan Wieck
On 10/27/2005 4:22 AM, Mario Splivalo wrote: I see no point in blatantly putting 'other' products such shape. Pgsql offers no replication at all, you need to use slony (wich is also a poor replacement for a wannabe replication), or some other commercial products. What about 2PC? What about linki

Re: [SQL] why vacuum

2005-10-27 Thread Jan Wieck
On 10/27/2005 4:22 AM, Mario Splivalo wrote: On Wed, 2005-10-26 at 12:09 -0400, Jan Wieck wrote: > You must have missed the FAQ and other side notes about replication in the MySQL manual. Essentially MySQL replication is nothing but a query duplicating system, with the added sugar of tak

Re: [SQL] why vacuum

2005-10-26 Thread Jan Wieck
On 10/26/2005 11:19 AM, Scott Marlowe wrote: On Tue, 2005-10-25 at 23:45, Kenneth Gonsalves wrote: hi, i was in a minor flame war with a mysql guy - his major grouse was that 'I wouldnt commit mission critical data to a database that needs to be vacuumed once a week'. So why does pg need vacu

Re: [SQL] pl/* overhead ...

2005-10-26 Thread Jan Wieck
PL/pgSQL is as *internal* as for example PL/Tcl. The two are actually pretty similar and I would expect them to perform similar, if one knows what and how he does. PL/pgSQL is an external shared object, loaded on call of the first func per backend. Same for PL/Tcl. PL/pgSQL takes pg_proc.pro

Re: [SQL] people who buy A, also buy C, D, E

2005-06-25 Thread Jan Wieck
On 6/24/2005 11:35 PM, Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 The goal of my query is: given a book, what did other people who bought this book also buy? I plan the list the 5 most popular such books. This sounds very much like one of the congestion problem

Re: [SQL] "copy from" in "create function"

2004-10-25 Thread Jan Wieck
On 10/20/2004 6:03 PM, Gifford Hesketh wrote: Am I forgetting some limitation ? I get "ERROR: syntax error at or near "$1" at character 22" with this: CREATE FUNCTION public.fn_b_import( text ) RETURNS void AS ' COPY b_import FROM $1 ; ' LANGUAGE 'sql' STABLE; Utility statements don't accept par

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Jan Wieck
On 8/31/2004 11:04 AM, Tom Lane wrote: Jan Wieck <[EMAIL PROTECTED]> writes: I agree that doing select 2::numeric ^ 100; should emit some sort of a warning. I do not. The conversion of 2::numeric to float is exact, so AFAICS the only way to do that would be to make *every* coerc

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Jan Wieck
On 8/31/2004 9:15 AM, Rajesh Kumar Mallah wrote: Michael Glaesemann wrote: On Aug 31, 2004, at 9:17 PM, Michael Glaesemann wrote: What you need is a power operation for numeric, which I think you'd have to write yourself, Looking a little closer, there is a pow() function that takes two numeric

Re: [SQL] PQexec and SPI_exec

2004-08-25 Thread Jan Wieck
On 8/25/2004 10:21 AM, Pedro B. wrote: Hello everyone. I'm experiencing some doubts regarding a procedure i have (.c compiled as .so) running as an 'after insert for each row' trigger. This trigger is supposed to do a simple query, something like SELECT * FROM table order by id where processed=0

Re: [SQL] Possible rounding error of large float values?

2004-08-24 Thread Jan Wieck
On 8/24/2004 4:21 PM, Oliver Elphick wrote: On Tue, 2004-08-24 at 20:52, Josh Berkus wrote: Adam, > 9223372036854775807 > > It gets selected out as: > > 9.22337203685478E18 This is a property of FLOAT data types. They round. > Which appears to be rounded. When we cast it to numeric type we get: >

Re: [SQL] multi column foreign key for implicitly unique columns

2004-08-19 Thread Jan Wieck
On 8/19/2004 12:52 PM, Oliver Elphick wrote: On Thu, 2004-08-19 at 17:21, Josh Berkus wrote: Jan, > Because the value in b.y is redundant. b.x->a.x->a.y is exactly the same > value and he even wants to ensure this with the constraint. And in the absence of that constraint, what ensures that b.y =

Re: [SQL] multi column foreign key for implicitly unique columns

2004-08-18 Thread Jan Wieck
On 8/18/2004 2:55 PM, Josh Berkus wrote: Jan, If a.x is unique, then (b.x, b.y) references (a.x, a.y) is only ensuring that the redundant copy of y in b.y stays in sync with a.y. So? What's denormalized about that? His other choice is to use a trigger. Because the value in b.y is redundant. b.x->

Re: [SQL] multi column foreign key for implicitly unique columns

2004-08-18 Thread Jan Wieck
On 8/18/2004 12:46 PM, Tom Lane wrote: Jan Wieck <[EMAIL PROTECTED]> writes: If we allow for a unique index, that * it is NOT maintained (no index tuples in there) * depends on another index that has a subset of columns * if that subset-index is dropped, the index becomes main

Re: [SQL] multi column foreign key for implicitly unique columns

2004-08-18 Thread Jan Wieck
On 8/18/2004 12:18 PM, Tom Lane wrote: Richard Huxton <[EMAIL PROTECTED]> writes: * Allow multiple unique constraints to share an index where one is a superset of the others' columns. That way you can mark it unique without having the overhead of multiple indexes. That just moves the uncertain-d

Re: [SQL] multi column foreign key for implicitly unique columns

2004-08-18 Thread Jan Wieck
On 8/18/2004 9:49 AM, Markus Bertheau wrote: Ð ÐÑÐ, 18.08.2004, Ð 15:33, Jan Wieck ÐÐÑÐÑ: Meaning that not enforcing the uniqueness of those columns isn't an option. The thing is that the columns _are_ unique, there's just no unique constraint on them. They are unique because there&

Re: [SQL] multi column foreign key for implicitly unique columns

2004-08-18 Thread Jan Wieck
On 8/17/2004 10:45 PM, Josh Berkus wrote: Markus, Hey, I see you figured out a workaround to writing a trigger for this. Let's see if we can make it work. ERROR: there is no unique constraint matching given keys for referenced table "objects" The reason for this is that CASCADE behavior

Re: [SQL] Make a column case insensitive

2004-08-08 Thread Jan Wieck
On 8/6/2004 11:29 AM, Gordon Ross wrote: Is it possible to make a column case insensitive, without having to pepper your SELECTs with lots of lower() function calls (and forgetting to do it at times !) (I'm on 7.4.3) With a little bit of legwork you can create an itext data type. It would just us

Re: [SQL] Trigger problem

2004-06-09 Thread Jan Wieck
On 6/8/2004 2:57 PM, Mike Rylander wrote: kasper wrote: Hi guys Im tryint to make a trigger that marks a tuble as changed whenever someone has updated it my table looks something like this create table myTable ( ... changed boolean; ) now ive been working on a trigger and a sp that looks li

Re: [SQL] Multitable uniqueness ?

2004-05-26 Thread Jan Wieck
Bruno Wolff III wrote: On Wed, May 26, 2004 at 05:13:14 +0200, Andreas <[EMAIL PROTECTED]> wrote: Is there a way to have something like this : UNIQUE (table_1.id, table_2.xxx) Postgres doesn't support database constraints at this time which is what you would need to do this simply. You can enfo

Re: [SQL] rule's behavior with join interesting

2004-04-22 Thread Jan Wieck
Richard Huxton wrote: On Wednesday 21 April 2004 21:07, Kemin Zhou wrote: Here I have a very simple case table1 table1_removed anotherTable create or replace RULE rec_remove as ON DELETE TO table1 do insert into table1_remove select old.*, a.acc from old g join anotherTable a on g.acc=a.other_acc

Re: [SQL] cursors and for loops?

2004-04-15 Thread Jan Wieck
Just FYI, recent versions of PG use cursors internally for PL/pgSQL FOR loops. So there is no danger for a procedure to run out of memory when looping over a huge result set ... at least not because of that. Jan Dennis wrote: Tom Lane writes: Something like LOOP FET

Re: [SQL] Compiling pl/pgsql functions

2004-02-19 Thread Jan Wieck
Rodrigo Sakai wrote: AFAIK there's not much you can do for obfuscation of pl functions right now since someone will be able to see the src text in pg_proc. However, are you allowing people that you don't want to see the code access to write arbitrary sql to the database? Let me explain myself a

Re: [SQL] bytea or blobs?

2004-02-17 Thread Jan Wieck
sactions at the same time of a transaction boundary. And the changes to the image file will not roll back if something goes wrong before you can commit the transaction. That can lead to funny effects on said website. Jan Thanks, Jeremy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL

Re: [SQL] bytea or blobs?

2004-02-17 Thread Jan Wieck
beyaNet Consultancy wrote: Hi, what I am trying to do is to be able to store images in my database. What I wanted to know is this: 1. Would it be better to have the image field type as a bytea or a blob? I have heard it mentioned that bytea would be better as doing data dumps would also insure

Re: [SQL] Unique Constraint with foreign Key

2004-02-17 Thread Jan Wieck
Greg Patnude wrote: Pleas also note that the referenced column in the foreign table either needs to be the PRIMARY KEY or have a unique constraint on it or maybe it just requires an index on it -- I'm not sure but I discovered that if the column in the foreign table (containing the REFERENCED key..

Re: [SQL]

2004-02-03 Thread Jan Wieck
Look at http://techdocs.postgresql.org/#convertfrom There are several documents discussing converting from MySQL to PostgreSQL. Jan Prashanthi Muthyala wrote: Hi I have a postgresql in my red hat linux machine which will be our webserver. previously we had mysql in suse linux in another ma

Re: [SQL] Sometimes referential integrity seems not to work

2004-02-03 Thread Jan Wieck
scott.marlowe wrote: On Mon, 2 Feb 2004, Jan Wieck wrote: Stephan Szabo wrote: > On Sat, 31 Jan 2004, Tom Lane wrote: > >> Stephan Szabo <[EMAIL PROTECTED]> writes: >> > On Mon, 26 Jan 2004, Enio Schutt Junior wrote: >> >> In a database I am working, I s

Re: [SQL] Sometimes referential integrity seems not to work

2004-02-02 Thread Jan Wieck
Stephan Szabo wrote: On Sat, 31 Jan 2004, Tom Lane wrote: Stephan Szabo <[EMAIL PROTECTED]> writes: > On Mon, 26 Jan 2004, Enio Schutt Junior wrote: >> In a database I am working, I sometimes have to delete all the records in >> some tables. According to the referential integrity defined in the c

Re: [SQL] Programatically switching database

2003-11-15 Thread Jan Wieck
Jan Wieck wrote: ow wrote: --- ow <[EMAIL PROTECTED]> wrote: How? The doc only mentions db: pg_dump [option...] [dbname] Then, how would I lock users out from the schema while it's being loaded? Never mind how, I see there's "-n namespace" option in 7.4. But still,

Re: [SQL] Programatically switching database

2003-11-15 Thread Jan Wieck
ow wrote: --- ow <[EMAIL PROTECTED]> wrote: How? The doc only mentions db: pg_dump [option...] [dbname] Then, how would I lock users out from the schema while it's being loaded? Never mind how, I see there's "-n namespace" option in 7.4. But still, how would I lock users out from the schema while

Re: [SQL] transaction processing after error in statement

2003-11-12 Thread Jan Wieck
Holger Jakobs wrote: Calling a procedure is a statement as well, and it includes all other procedures called from this procedure. So the statement level is always the statements that were carried out directly in the transaction. If anything within one statement fails, the statement was not carried

Re: [SQL] transaction processing after error in statement

2003-11-11 Thread Jan Wieck
Holger Jakobs wrote: Why is that "funny behaviour" for you? By putting the statements into a transaction block you told the data management system "I want this group of statements to be atomic". Atomic means all or nothing. It might not be exactly what you intended to say, and you have a point if

Re: [SQL] transaction processing after error in statement

2003-11-10 Thread Jan Wieck
Holger Jakobs wrote: Hi Stephan, On 9 Nov, Stephan Szabo wrote: On Fri, 7 Nov 2003 [EMAIL PROTECTED] wrote: Whenever an error occurs within the transaction, PostgreSQL puts the whole transaction in an *ABORT* state, so that there is no difference at all between COMMITing or ROLLBACKing it. Even

Re: [SQL] 7.4 and 7.3.5 showstopper

2003-10-30 Thread Jan Wieck
Jan Wieck wrote: Confirmed, that's a bug - pgsql-hackers CC'd and scipt for full reproduction attached. Assumptions where correct, bug fixed in REL7_3_STABLE and HEAD. I also added a slightly modified version of the script that reproduced the bug to the foreign_key regression test.

7.4 and 7.3.5 showstopper (was: Re: [SQL] Bug in Rule+Foreing key constrain?)

2003-10-30 Thread Jan Wieck
ORE INSERT trigger in PL/pgSQL that tries to UPDATE the row and if GET DIAGNOSTICS tells it it succeeded, returns NULL to suppress the INSERT. That should work around the bug for the time being. Jan Michele Bendazzoli wrote: On Thu, 2003-10-30 at 18:29, Jan Wieck wrote: Not entirely. On which ta

Re: [SQL] Bug in Rule+Foreing key constrain?

2003-10-30 Thread Jan Wieck
Michele Bendazzoli wrote: I have found a strange behaviour that I don't know if is a bug or not. I have three tables: * abilitazione with a primary key of (comuneid, cassonettoid, chiaveid) * cassonetto with a primary key of (comuneid, cassonettoid) * chiave with a primary key of (comuneid, chi

Re: [SQL] strange postgresql failure

2003-10-30 Thread Jan Wieck
Tomasz Myrta wrote: Dnia 2003-10-30 12:32, Użytkownik Tomasz Myrta napisał: After few seconds all backends were disconnected and postgres restarted. It didn't help :-( Even reboot didn't help... Postgres is 7.3.2-2 on Debian Woody. Sorry for my panic. It was my C function which raised segmentat

Re: [SQL]

2003-10-09 Thread Jan Wieck
Vishal Charan (IT Fiji) wrote: please remove my email from your database contacts. Best Regards, *_Vishal Charan_* *IT Support * *Courts/Homecentres* Is this another worm that attempts to lower the internet traffic by requesting to remove people from mailing lists? It's the 5th or so "unsubs

Re: [SQL] [HACKERS] plpgsql doesn't coerce boolean expressions to boolean

2003-09-09 Thread Jan Wieck
Tom Lane wrote: Jan Wieck <[EMAIL PROTECTED]> writes: ERROR is the cleanest way, but I'd vote for conversion to boolean to keep the damage within reason. Which style of conversion did you like? These were the choices: 3. Try to convert nonbooleans to boolean using plpgsql's

Re: [SQL] [HACKERS] plpgsql doesn't coerce boolean expressions to boolean

2003-09-09 Thread Jan Wieck
Tom Lane wrote: Following up this gripe http://archives.postgresql.org/pgsql-sql/2003-09/msg00044.php I've realized that plpgsql just assumes that the test expression of an IF, WHILE, or EXIT statement is a boolean expression. It doesn't take any measures to ensure this is the case or convert t

Re: [SQL] BEFORE UPDATE Triggers

2003-09-01 Thread Jan Wieck
Tom Lane wrote: Jan Wieck <[EMAIL PROTECTED]> writes: Unfortunately, you're right. There is no way do distinguish in a trigger or rule if a value in the new row did result from the UPDATE query or from target list expansion with OLD values. It would not be terribly hard to

Re: [SQL] BEFORE UPDATE Triggers

2003-08-30 Thread Jan Wieck
Chris Anderson wrote: PostgreSQL Version: 7.2.3 Procedural Language: PL/pgSQL I have a table which contains a field for the user who last modified the record. Whenever a row in this table is updated, I want to have an UPDATE trigger do the following things: 1) Ensure the UPDATE query supplied

Re: [SQL] trigger proceedures in sql

2003-07-13 Thread Jan Wieck
Rajesh Kumar Mallah wrote: Yes of course! contrib/dbmirror does execute a procedure written in 'C' called recordchange() ON update , insert , delete. If you need help in getting its source lemme know. regds Mallah. On Thursday 10 Jul 2003 11:10 am, adivi wrote: hi, can trigger proceedures (

Re: [SQL] Break referential integrity.

2003-07-09 Thread Jan Wieck
Stephan Szabo wrote: On Wed, 2 Jul 2003, Rudi Starcevic wrote: Hi, I know that if you have a trigger and function then drop/replace the function the trigger needs to be drop/replaced too so that it can see the new function. Is it the same for Ref. Integ. on table's too ? If table B's foreign key

Re: [SQL] question on rules

2003-06-13 Thread Jan Wieck
Tom Lane wrote: [EMAIL PROTECTED] writes: i'd like to write an rule which fills out some empty attrs on insert (w/ data from other given attrs). You'd be better off doing this with a BEFORE INSERT trigger. The only way to do it with rules would be to create a view over the basetable, create an in

Re: [SQL] (long) What's the problem?

2003-06-08 Thread Jan Wieck
David Olbersen wrote: Anybody have any ideas about a problem with this query? urldb2=> EXPLAIN urldb2-> SELECT urldb2-> id, urldb2-> source, urldb2-> insertedby, urldb2-> insertedon, urldb2-> priority urldb2-> FROM urldb2-> indexscan urldb2-> WHERE urldb2-> lower( urldb2-> substr

Re: [SQL] simulating partial fkeys..

2003-06-06 Thread Jan Wieck
[EMAIL PROTECTED] wrote: hi , Is there any way to enforce fkeys only on subset of the table something on the lines of unique partial indexes Sure. Put NULL values into the referencing fields of those rows you don't want to be checked. Jan -- #

Re: [SQL] How to notice column changes in trigger

2003-03-31 Thread Jan Wieck
Josh Berkus wrote: > > Andreas, > > > 1) update test set a=0 -> trigger does its work > > 2) update test set a=0, b=1, c=2 -> trigger does nothing > > 3) update test set a=0, b=b, c=c -> trigger does nothing, but content of > > a and b dont change either although touched > > > IF OLD.b=NEW.b wil

Re: [SQL] automatic time/user stamp - rule or trigger?

2003-02-05 Thread Jan Wieck
Achilleus Mantzios wrote: > > On Wed, 5 Feb 2003, Neal Lindsay wrote: > > > I have a table that I want to keep track of the user who last modified > > it and the timestamp of the modification. Should I use a trigger or a rule? > > > > CREATE TABLE stampedtable ( > > stampedtableid SERIAL PR

Re: [SQL] Postgresql To Oracle9i

2003-02-05 Thread Jan Wieck
Atul Pedgaonkar wrote: > > Hello, > > Atul here From india.Anyone who knows how to mirgrate the data from > postgresql7.2 to Oracle9i.Please give the idea or methood to transfer the > data. Use pg_dump to create separate schema and data (as INSERT statements) dumps. Edit the schema so th

Re: [SQL] iceberg queries

2003-02-04 Thread Jan Wieck
Tom Lane wrote: > > Jan Wieck <[EMAIL PROTECTED]> writes: > > As to the original question, if an index is available that returns the > > rows in the sort order of the GROUP BY clause, PostgreSQL defaults to an > > index scan, otherwise it will do a sort of the rows

Re: [SQL] iceberg queries

2003-02-04 Thread Jan Wieck
Christoph Haller wrote: > > > > > Does PostgreSQL optimizer handle iceberg queries well? > > > What do you mean by "iceberg query" ? > I've never heard this term. Iceberg queries compute one or more aggregate functions to find aggregate values above a specified threshold. A typical iceberg query

Re: [SQL] pg_views

2003-02-04 Thread Jan Wieck
Lex Berezhny wrote: > > hi, > > I'm trying to write some code that can analyze the database structure > and i need a way to discover the composition of a view (the tables and > table.column info). > > I've managed to do much of this by querying the pg_views for the > definition and literally

Re: [SQL] To use a VIEW or not to use a View.....

2003-01-22 Thread Jan Wieck
Tomasz Myrta wrote: > > Jan Wieck wrote: > > >Use tables, views and views over views, it's all fine and your indexes > >will be used. > > I can't agree with using views over views. It has some limitations. > I asked about it on this list several months

Re: [SQL] To use a VIEW or not to use a View.....

2003-01-22 Thread Jan Wieck
Ries van Twisk wrote: > > Dear PostgreSQL users, > > I have a view and a table, > > I understand that when a frontend accesses a VIEW that PostgreSQL cannot use > a index on that view. > For example when I do this: SELECT * FROM full_cablelist WHERE > projectocode=5; Correct? No. > > Now I j

Re: [SQL] [GENERAL] double precision to numeric overflow error

2003-01-17 Thread Jan Wieck
Thomas O'Connell wrote: > > Well, it would've immediately (rather than the several minutes it took) > given away the problem if it read something like: > > ERROR: overflow caused by cast of double precision value to numeric > without sufficient precision, scale (15, 6) > > or even, depending on

Re: [SQL] SQL function triggers

2002-10-15 Thread Jan Wieck
Brian Blaha wrote: > > I would like to write a function as a set of SQL statements, and then > use that function > in a trigger. However, since triggers require a return type of opaque, > and SQL functions > cannot return type opaque, this doesn't look possible. Am I missing > something? The SQL

Re: [SQL] LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?

2002-08-26 Thread Jan Wieck
Bruce Momjian wrote: > > I found this email from April. It properly points out that our > LIMIT/FOR UPDATE ordering doesn't match MySQL's, and MySQL's looks more > correct, specifically that the FOR UPDATE is after the LIMIT. Our > grammar is: How do you define "correct" for "non-standard" fea

Re: [SQL] Last record

2002-07-24 Thread Jan Wieck
Leao Torre do Vale wrote: > How can select one field of last > record of table? There is no such thing as the "last record of a table" in SQL. Somehow you must be able to describe what you mean with "last record" and how to identify that. This would then be translated into a qualification (WHERE

Re: [SQL] Float / Numeric ?

2002-07-22 Thread Jan Wieck
Rudi Starcevic wrote: > > Hi Folks, > > I have an ecommerce application I'm writing and I'm not sure / undecided > on a > particular way to store shipping rates in PostgreSQL > > In this application a user may set the shipping rate per item. > > So I have 3 fields - local,state and internation

Re: [SQL] Query kill

2002-07-12 Thread Jan Wieck
Bruce Momjian wrote: > > Jan Wieck wrote: > > Bruce Momjian wrote: > > > > > > Rudi Starcevic wrote: > > > > Hello, > > > > > > > > If I write a query that is inefficient or in an eternal loop how > > > > do I stop it

Re: [SQL] Query kill

2002-07-12 Thread Jan Wieck
Bruce Momjian wrote: > > Rudi Starcevic wrote: > > Hello, > > > > If I write a query that is inefficient or in an eternal loop how > > do I stop it without restarting the postmaster ? > > > > I can see many postmaster processed appearing in the output of the 'ps' > > command. > > Do I need to sto

Re: [SQL] rules / triggers on insert. why after?

2002-07-12 Thread Jan Wieck
Ahti Legonkov wrote: > Does anyone know why since postgres 7.2 the rules are executed *after* > the insert? Because people where still complaining that they changed to execute *before* in v6.4. Jan -- #==# # It's easier to

Re: [SQL] list of tables ? -update to question ...

2002-07-11 Thread Jan Wieck
Steve Brett wrote: > > sorry ... i didn't make myself clear ... > > i have of course come across \dt before ... > > what i meant was via sql as in 'select tablelist from perhaps ?>' What about: SELECT * FROM pg_tables; Jan -- #

Re: [SQL] Waiting for Update

2002-07-10 Thread Jan Wieck
JGM wrote: > > Could it be true?? > > I've a table with < 46000 rows. And a little Update like > > UPDATE foo set xxx = 'X'; > > needs about 15 seconds??? > > What's wrong? How long since you vacuumed that table? How big are the rows? Are there triggers, constraints, anything fancy? How many

Re: [SQL] Rule WHERE condition problem

2002-07-09 Thread Jan Wieck
Kristian Eide wrote: > > I have a table with a reference constraint and an ON DELETE SET NULL action. > When this action triggers, I also want to update another field in the table, > actually a timestamp which should be set to NOW(). > > After reading some documentation it would seem a rule is t

Re: [SQL] pg_restore cannot restore function

2002-07-01 Thread Jan Wieck
Sent: Friday, June 28, 2002 1:46 PM > To: 'Jan Wieck' > Cc: 'Bruce Momjian'; '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]' > Subject: RE: [SQL] pg_restore cannot restore function > > No any error msg in the logfile, I didn't see any create funct

Re: [SQL] how to sort a birthday list ?

2002-06-21 Thread Jan Wieck
Bruno Wolff III wrote: > > On Fri, Jun 21, 2002 at 10:30:54 +0200, > Michael Agbaglo <[EMAIL PROTECTED]> wrote: > > > > of course you could sort by DOY but then you'll have a problem w/ the > > next year: > > > > if it's let's say december and you select the list for the next 60 days, > > perso

Re: [SQL] function not running after upgrade from 7.03 to 7.2

2002-06-14 Thread Jan Wieck
[EMAIL PROTECTED] wrote: > > Hello > > I have three functions running under 7.03, Now, after the Upgrade to 7.2 > these functions are not working. > What has changed in version 7.2 that causes this problem. > > Function : > > CREATE FUNCTION "buildUmfang"("bpchar") RETURNS "text" AS 'DECLARE >

Re: [SQL] ON DELETE CASCADE question

2002-06-14 Thread Jan Wieck
Josh Berkus wrote: > > Wei, > > > Does ON DELETE CASCADE attribute you specify in CREATE TABLE > > statement > > actually create triggers for every foreign key it refers to? > > > > Yes. Two triggers for each key, I think. Three, one for INSERT OR UPDATE on the FK table, one for UPDAT

Re: [SQL] make a unique index for foreign keys?

2002-06-13 Thread Jan Wieck
Beth Gatewood wrote: > > Chris/ Josh- > > OK-response to Chris below. Synopsis heresimply by creating a foreign > key will not create an index. On large tables I SHOULD put a non-unique > index on the foreign key (right?) Right, because on DELETE or UPDATE to the primary key, the

Re: [SQL] CHECK problem really OK now...

2001-09-24 Thread Jan Wieck
Kovacs Baldvin wrote: > Hi everybody! > > I tried, and it works: the current CVS version really runs > happily the query what sent to heaven our 7.1 version of the > backend. > > Kevin: your original complex schema also runs smoothly. > > Thanks for our mindful developers! > > Regards, > Baldvin >

Re: [SQL] confounding, incorrect constraint error

2001-09-24 Thread Jan Wieck
Kevin Way wrote: > I'm unemployed at the moment and this is a pet project, so I can't offer > much in the way of financial compensation, but I'll start the bidding at > $50 donation in your name to your choice of the EFF, the Red Cross, or the > American Cancer Society, in return for a fix. (If n

Re: [SQL] calling a shell script from pl/pgsql

2001-09-11 Thread Jan Wieck
Jeff Barrett wrote: > Thanks for the suggestions. > > I am running 7.1.2 and going to 7.1.3 soon. > > If I use pl/tclu or pl/perlu I can call this executable from within the > code? > > I have a signifigant limitation, I cannot duplicate the action of the > programs I want to call in a program I w

[SQL] Re: [GENERAL] protected ON DELETE CASCADE

2001-08-23 Thread Jan Wieck
Murray Hobbs wrote: > > i neglected to show it properly > > have tables A, B, C, D PLUS a few others > > A <- B > > F > | > v > A <- C <- D > ^ > | > E > > i want to delete from C and cascade any delete to E or F but not if > there are records in D > > what i have don

[SQL] Re: [GENERAL] protected ON DELETE CASCADE

2001-08-23 Thread Jan Wieck
Murray Hobbs wrote: > > here's my problem > > i have tables A, B, C, D > > A <- B > A <- C <- D > > i want to maintain integrity so that if A is deleted from then so is > anything referencing from B and C - no problem ON DELETE CASCADE > > but if there are any D's that point back to A (through com

Re: [SQL] on update restrict

2001-08-15 Thread Jan Wieck
Mister ics wrote: > > > > The behaviour is correct according to the SQL specifications. > > RESTRICT (as well as NO ACTION) means, you cannot change the > > primary key value of the referenced row. All other values can > > be changed of course. > > > > So an attempt to > > > >

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

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] 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 >

Re: [SQL] REFERENCES constraint

2001-08-08 Thread Jan Wieck
Josh Berkus wrote: > Cedar, > > > 1. Can a column reference more than one table? (This assumes you use > > a > > single sequence to generate the IDs for both "tbla" and "tblb". I > > guess > > you would also have the problem of enforcing a unique index. Say > > what?! > > A unique index across

Re: [SQL] Are circular REFERENCES possible ?

2001-08-07 Thread Jan Wieck
Josh Berkus wrote: > Jan, > > > All of this is wrong. If the constraints are defined to be > > INITIALLY DEFERRED, all you have to do is to wrap all the > > changes that put the database into a temporary inconsistent > > state into a transaction. What is a good idea and

Re: [SQL] Are circular REFERENCES possible ?

2001-08-07 Thread Jan Wieck
Tom Lane wrote: > Jan Wieck <[EMAIL PROTECTED]> writes: > > The point is that we based our implementation of foreign keys > > on the SQL3 specs. DEFERRED is not in SQL-92 AFAIK. > > I still have a concern about this --- sure, you can set up the circular > ref

Re: [SQL] Are circular REFERENCES possible ?

2001-08-07 Thread Jan Wieck
Josh Berkus wrote: > Denis, > > > I have a case where I wanted to do circular REFERENCES, is this > > impossible ? > > It can be done. It's just a bad idea. I don't see why it is a bad idea to apply the full business model to the database schema. > > Now, each shop REFERENCES a custom

Re: [SQL] Simple Insert Problem

2001-08-07 Thread Jan Wieck
[EMAIL PROTECTED] wrote: > Josh, > > Fuck you and the high horse you rode in on. Stop that language immediately! It is not accepted on any of our PostgreSQL mailing lists. > Yes as a matter of fact I did forget the quote marks. Do you think reading > that book will help with my silly sy

Re: [SQL] Foreign key

2001-08-02 Thread Jan Wieck
Lorenzo De Vito wrote: > What's the best way to build a relation between two tables ? > I know that Foreign key is no longer supported. Who told you so? Jan -- #==# # It's easier to get forgiveness for being wrong than fo

Re: [SQL] plpgsql function return multiple values?

2001-07-30 Thread Jan Wieck
John Oakes wrote: > Is it possible for a plpgsql function to return a record? I need to return > multiple values, and preferably in the form of a record. Thanks in advance! Not useful in any released version of PostgreSQL. In v7.2 you'll have at least the possibility to return a

Re: [SQL] Why does this plpgslq always return 1?

2001-07-30 Thread Jan Wieck
Stephan Szabo wrote: > On Fri, 27 Jul 2001, John Oakes wrote: > > > Can anyone tell me why this always return 1? Thanks! > > > > CREATE FUNCTION passrate(date, date, text) RETURNS float AS ' > > > > DECLARE > > begindate ALIAS FOR $1; > > enddate ALIAS FOR $2; > > passfail ALIAS FOR $3; > > r

Re: [SQL] Re: PLpgSQL

2001-07-23 Thread Jan Wieck
Josh Berkus wrote: > Dado, > > > But still, the $1 is still plaguing me. > > > > Here's your problem: > > > >>CREATE FUNCTION new_proj_pts_seq(int4) > > >>RETURNS text > > >>AS 'DECLARE > > >>proj_ID alias for $1; > > >>seq_name TEXT; > > >>BEGIN > > >>seq_name := '

Re: [SQL] Possible problems with cyclic references

2001-07-23 Thread Jan Wieck
Gary Stainburn wrote: > Hi all, me again. > > I've been looking at the doc's again (must stop doing that!) > > I've been looking at the 'references' clause to implement referential > integrity. My problem is that I'm wanting to create a cyclic reference, and > was wondering what problems this may

Re: [SQL] SPI_exec does not return!

2001-07-18 Thread Jan Wieck
Markus Wagner wrote: > Hi, > > if I do a SELECT on a non-existing table, SPI_exec won't return. > I get, e. g. in pgaccess, an error message " does not exist", > and my code below the function call is never reached. Right, the SPI_exec() call in turn calls the PostgreSQL parser and

Re: [SQL] can we write to a flat file from Postgresql procedure

2001-07-11 Thread Jan Wieck
R Vijayanath wrote: > Hi, > > I found your name in the Postgresql web site. > > It would be great if you can tell me if I can write a > procedure that can write the output to the OS(Linux > OS) file. > > Can you assist me on this if there is a way to do it. > > We are using Postgresql 7.1 running

Re: [SQL] select only the first record

2001-07-10 Thread Jan Wieck
[EMAIL PROTECTED] wrote: > Hello there > > Is it possible to do a query and selecting only the first record in ad > table ? > > e.g. select FIRST * from cars You can either use a CURSOR and FETCH only the first row, or use LIMIT (non-standard). And you might want to explicitly O

[SQL] Re: [GENERAL] Cross database foreign keys

2001-07-06 Thread Jan Wieck
Morgan Curley wrote: > Does anyone know if it is possible to connect to a differernt db from > within a plsql function. > I have multilple inter-related schemas and want to enforce some fk > relationships. PL/pgSQL doesn't support external database connects. PL/TclU does. But keep i

Re: [SQL] rules

2001-04-26 Thread Jan Wieck
Martín Marqués wrote: > Is it posible to make a rule execute more then one query? > > Something like: > > CREATE RULE rule_name AS ON INSERT TO table1 > DO INSTEAD > INSERT INTO table2 VALUES > (new.value1,new.value2) > INSERT INTO table3 VALUES > (x,y) Yes: CREATE RULE rule_name AS

Re: [SQL] Error explaination?

2001-04-25 Thread Jan Wieck
Josh Berkus wrote: > Folks, > >I have a fuction that creates a record in a table called user_locks, > does a bunch of stuff, then deletes the record. However, when I try to > run it, I get the following error: > > ERROR: triggered data change violation on relation "user_locks" > >It appe

  1   2   >