Re: [SQL] 8K Limit, whats the best strategy?

2000-08-21 Thread Jan Wieck
Poul L. Christiansen wrote: > Jan Wieck wrote: > > > Poul L. Christiansen wrote: > > > I've just split the text up (in 8 pieces), so it fits into 8K rows. But thats > > > only a viable solution if your text is less than a couple of 100K's. > > >

Re: [SQL] 8K Limit, whats the best strategy?

2000-08-21 Thread Jan Wieck
Poul L. Christiansen wrote: > I've just split the text up (in 8 pieces), so it fits into 8K rows. But thats > only a viable solution if your text is less than a couple of 100K's. > > You could try to be a daredevil and use the Toast code, even if it's beta. But > I don't know how far the Toast pro

Re: [SQL] Continuous inserts...

2000-08-22 Thread Jan Wieck
Stephan Szabo wrote: > Wierd, I've not seen that behavior really, although I've never > done time sensitive stuff. It might be the time before the > shared cache updates? Not sure really. If you do the rule > inline with your inserts (rather than a second transaction) > does it still wait?

Re: [SQL] Using SETOF in plpgsql function

2000-08-23 Thread Jan Wieck
hlefebvre wrote: > Hello, > > I'd like to return a set of integer in an pl/pgsql function. How can I > do that ? You can't. Not with PL/pgSQL nor with any other PL or C. The problem is nested deeper and requires the planned querytree redesign to get solved. Before you ask: T

Re: [SQL] Using SETOF in plpgsql function

2000-08-23 Thread Jan Wieck
Tom Lane wrote: > Jan Wieck <[EMAIL PROTECTED]> writes: > > hlefebvre wrote: > >> I'd like to return a set of integer in an pl/pgsql function. How can I > >> do that ? > > > You can't. Not with PL/pgSQL nor with any other PL or C. T

Re: [SQL] RE: Create table in functions

2000-08-31 Thread Jan Wieck
Andreas Tille wrote: > On Thu, 24 Aug 2000, Hiroshi Inoue wrote: > > > Hmm,Andreas's original function seems to contain other statements. > > If the function contains DML statements for the table Temp_Num_Table, > > it wouldn't work properly. i.e 1st call would work but 2nd call woudn't. > That's

Re: [SQL] pg_hba.conf

2000-09-04 Thread Jan Wieck
Craig May wrote: > I've renamed the file to "pg_hba.conf". It's owner and groug are now postgres. > The file is located in /usr/lib/pgsql/. I'm still receiving the same error. Network setup? Contents of pg_hba.conf? How should someone tell you what's wrong with the information you

[SQL] Re: [GENERAL] function

2000-08-30 Thread Jan Wieck
Normunds wrote: > Hi all, > > how can I write function which takes text from one field, replaces > some characters and puts it in other field? I have array with old and > new values. > > For example: > old array = {'r', 'Z', 'o'} > new array = {'s', 'm', 't'} > old field value = 'Zorro' > new fiel

[SQL] Re: [HACKERS] foreign key introduces unnecessary locking ?

2000-10-23 Thread Jan Wieck
Mikheev, Vadim wrote: > Try this for both FK tables: > > create table tmp2(idx2 int4, col2 int4, constraint > tmpcon2 foreign key(col2) references tmp1(idx) INITIALLY DEFERRED); > > This will defer constraint checks till transaction commit... > though constraint triggers should use SnapshotDirty i

Re: [SQL] Re: Requests for Development

2000-11-17 Thread Jan Wieck
KuroiNeko wrote: > > I wonder if there couldn't borrowed some code from Interbase which has > > full featured stored procedures - at least it was told to me that it has > > ... > > Well, I have some hands-on experience with IB, don't know whether this is > perfectly relevant, but here goes

Re: [SQL] Requests for Development

2000-11-17 Thread Jan Wieck
Josh Berkus wrote: > Tom, Bruce, Jan, etc.: > > [...] > > The rest of these requests apply to 7.2: > > 2. Stored Procedure functionality, i.e. outputting a full recordset from > a function (or new structure, if functions are hard to adapt) based on > the last SELECT statement passed to the functio

Re: [SQL] problem with keyword 'old'

2000-12-03 Thread Jan Wieck
Basilis Kladis wrote: [Charset iso-8859-7 unsupported, filtering to ASCII...] > I am ussing Postgresql v. 6.3 in a RedHat Linux system. I try to create a > rule to log the deletes on table 'filter' ussing the following: First of all, the rule system up to version 6.3 is known to be bro

[HACKERS] Re: [SQL] Rules with Conditions: Bug, or Misunderstanding

2000-12-03 Thread Jan Wieck
Tom Lane wrote: > "Joel Burton" <[EMAIL PROTECTED]> writes: > > create rule dev_ins as on update to dev_col_comments where > > old.description isnull do instead insert into pg_description ( objoid, > > description) values (old.att_oid, new.description); > > > create rule dev_upd as on update to de

[HACKERS] Re: [SQL] Rules with Conditions: Bug, or Misunderstanding

2000-12-04 Thread Jan Wieck
Tom Lane wrote: > Jan Wieck <[EMAIL PROTECTED]> writes: > > Tom Lane wrote: > >> Hm. Perhaps the "cannot update view" test is too strict --- it's not > >> bright enough to realize that the two rules together cover all cases, > >> so it com

Re: [SQL] Strange slow behavior in backend

2000-12-14 Thread Jan Wieck
Tom Lane wrote: > Kyle <[EMAIL PROTECTED]> writes: > > This worked great until I put a real big file in (about 5M). Then, when > > I tried to fetch the file, it seemed really slow (about 60 seconds). I > > tried reassembling the file in the frontend instead and my time dropped > > to about 6 sec

Re: [SQL] Strange slow behavior in backend

2000-12-14 Thread Jan Wieck
Kyle wrote: > I'm using 7.0.1 with a TCL frontend. > > I have a schema that splits large files into tuple-sized bites and > stores them in a table. This was done before TOAST in order to store > large files. > > I have a backend TCL function that re-assembles the file like this: > > -- Fetch the

Re: [SQL] Rules

2001-01-02 Thread Jan Wieck
Peeter Smitt wrote: > Hi > > I'm trying to make updateable view useing rules. > > CREATE RULE update_rule AS ON UPDATE TO table DO INSTEAD > SELECT fun1(new); > > Thing is that backend gives this error. > ERROR: parser: parse error at or near ")" > > What i'm doing wrong? Are there any other

Re: [SQL] pl/pgsql Limits

2001-01-13 Thread Jan Wieck
Najm Hashmi wrote: > Hi All, > As it is known that any funtion, written in pl/pgsql, can only > retrun one tuple. I am just wondering it were true as well for function > written in C language. I need to write few function that will retrun > mulitiple rows satsifying a certain set of conditi

Re: [SQL] Question #4 about PL/PGSQL

2001-01-16 Thread Jan Wieck
Josh Berkus wrote: > Folks, > > Oh, yes, one more: > > 4. If I pass a NULL to any of the parameters of a PL/PGSQL > function, any (other) VARCHAR parameters are set to NULL as > well. Fixed in 7.1. Impossible to fix in 7.0.x or earlier due to missing capabilities of the function manage

Re: [SQL] Three questions regarding PL/PGSQL

2001-01-16 Thread Jan Wieck
) if the correct number of rows has been hit. > Anybody (Jan?) who can shed some light on the above will > receive my enthusiastic gratitude in ASCII text. Some sql examples would allways help. > P.P.S. My most heartfelt gratitude to Jan Wieck for writing > some dec

Re: [INTERFACES] Re: [SQL] improve performance

2001-01-17 Thread Jan Wieck
Hannu Krosing wrote: > Tom Lane wrote: > > > > > > I've heard lots of people want to increase BLCKSZ, but you're the first > > one who ever wanted to reduce it. You sure you want to do this? It's > > going to make the maximum row length uncomfortably short. > > And it may even not work, as some

Re: [SQL] unreferenced primary keys: garbage collection

2001-01-20 Thread Jan Wieck
Forest Wilkinson wrote: > I have a database in which five separate tables may (or may not) reference > any given row in a table of postal addresses. I am using the primary / > foreign key support in postgres 7 to represent these references. > > My problem is that, any time a reference is removed

Re: [SQL] unreferenced primary keys: garbage collection

2001-01-22 Thread Jan Wieck
Jan Wieck wrote: > Forest Wilkinson wrote: > > I have a database in which five separate tables may (or may not) reference > > any given row in a table of postal addresses. I am using the primary / > > foreign key support in postgres 7 to represent these references. >

Re: [SQL] Rules and transactions

2001-01-24 Thread Jan Wieck
Brett Schwarz wrote: > If I have a rule, is the rule inside a tranaction along with the table that > it references. For example, if I have a rule that deletes an entry from > table B, whenever an entry in table A gets deleted, then is the delete for > table A and table B wrapped inside the same tr

Re: [SQL] Rule not invoked in 7.1

2001-01-25 Thread Jan Wieck
Tom Lane wrote: > Kyle <[EMAIL PROTECTED]> writes: > > ERROR: Cannot update a view without an appropriate rule. > > 7.1 insists that you provide an *unconditional* DO INSTEAD rule > for a view. What do you think was happening on your old database > when the "where old.status = 'appr'" clause was

Re: [SQL] Rule not invoked in 7.1

2001-01-26 Thread Jan Wieck
Tom Lane wrote: > Kyle <[EMAIL PROTECTED]> writes: > > If someone happens to know the primary key of a record they should not be > > able to access, and they try to update it, I would like the backend to > > ignore the query (or better yet, raise an exception but I haven't figured > > out how to d

[SQL]

2001-01-26 Thread Jan Wieck
Kyle wrote: > The only complication is > that there are a class of records which the user should be able to view, but not > modify. For example, > the employee can create and modify working records as long as the only > modification to their status > is to move them on to "open status" (creating

Re: [SQL] Rule not invoked in 7.1

2001-01-26 Thread Jan Wieck
Kyle wrote: > The only complication is > that there are a class of records which the user should be able to view, but not > modify. For example, > the employee can create and modify working records as long as the only > modification to their status > is to move them on to "open status" (creating

Re: [SQL]

2001-01-29 Thread Jan Wieck
Olivier PRENANT wrote: > set nomail ERROR: permission denied Jan -- #==# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #=

Re: [SQL] Hrm...why is this wrong?

2001-02-08 Thread Jan Wieck
Ken Corey wrote: > Wow! Answering emails on a Sunday? Someone should be giving you an award or > something. > > On Sunday 04 February 2001 8:13 pm, you wrote: > > Ken Corey <[EMAIL PROTECTED]> writes: > > > When the select at the bottom of this email is executed, I'm getting the > > > message: >

Re: [SQL] Is this a bug, or is it just me?

2001-02-08 Thread Jan Wieck
Josh Berkus wrote: > Tom et al. > > Discovered this quirk in foriegn keys: > > In the preliminary version of a database, I added foriegn > key constraints to a number of tables, linking them to a > column in a shared reference table (status.status) that was > only one-half of a composite primary k

[SQL] Re: PL/pgsql EXECUTE 'SELECT INTO ...'

2001-02-08 Thread Jan Wieck
Tom Lane wrote: > I have looked a little bit at what it'd take to make SELECT INTO inside > an EXECUTE work the same as it does in plain plpgsql --- that is, the > INTO should reference plpgsql variables, not a destination table. > It looks to me like this is possible but would require some nontri

Re: [HACKERS] Re: [SQL] PL/PGSQL function with parameters

2001-02-08 Thread Jan Wieck
Tom Lane wrote: > Michael Ansley <[EMAIL PROTECTED]> writes: > > CREATE FUNCTION table_count(varchar) RETURNS integer AS ' > > DECLARE > > SQL varchar; > > RES integer; > > BEGIN > > SQL = ''SELECT * INTO temp1 FROM '' || $1; > > EXECUTE SQL; > > SELECT count(*) INTO RES FROM temp1; > > RETU

Re: [SQL] PL/PGSQL function with parameters

2001-02-08 Thread Jan Wieck
Josh Berkus wrote: > Tom, Jan, Michael, > > > While I have not looked closely, I seem to recall that plpgsql handles > > INTO by stripping that clause out of the statement before it's passed to > > the SQL engine. Evidently that's not happening in the EXECUTE case. > > > > Jan, do you agree this

Re: [SQL] Trigger question

2001-02-14 Thread Jan Wieck
Dave Wedwick wrote: > Hi! > > I have a table with an int4 field called inserttime. Regardless of what > the user enters in this field, I want a trigger to put now() into it. > > What's the syntax for the trigger? Sample: CREATE TABLE t1 ( id serial PRIMARY KEY,

Re: [SQL] Need your help

2001-02-28 Thread Jan Wieck
Jie Liang wrote: > e.g. > Try: > > CREATE TABLE emp ( > id int4 primary key, > empname text, > salary int4, > last_date datetime, > last_user name); > > CREATE FUNCTION emp_stamp () RETURNS OPAQUE AS > BEGIN >update emp set last_date=''now''::timestamp where id=NEW.id;

Re: [SQL] Help creating rules/triggers/functions

2001-03-03 Thread Jan Wieck
Blaise Carrupt wrote: > Hi all ! > > I use PostgreSQL 7.0.2 on a HP-UX system. > > I would like to create a simple function and a simple trigger (or rule) that > deny a delete from a table if the row is referenced in another table. > > I though it should look like this (from my Ingres experience..

Re: [SQL] PL/PgSQL and NULL

2001-03-15 Thread Jan Wieck
Jie Liang wrote: > > I think that is a bug in plpgsql, > when passing a NULL into a plpgsql defined function, it treats > other arguments as NULL also, you can use raise notice in > your function to watch this buggy thing(see following). You're blaming the wrong code for it. It's an insuffi

Re: [SQL] PL/pgSQL "compilation error"

2001-03-15 Thread Jan Wieck
Josh Berkus wrote: > This brings up an important point. We have a medium-large user base for > PL/pgSQL out there, but it appears that Jan Wieck no longer has time to > develop the language ... nor should he be the sole developer. Howe do > we find more developers to expand &

Re: [SQL] pl/Perl

2001-03-15 Thread Jan Wieck
Jie Liang wrote: > Tom, > > 1.Where or how I can get pltcl.so? I have not find this file anywhere in > my > source except a pltcl.c. > 2.Dose installation same as plpgsql? > i.e. > CREATE FUNCTION pltcl_call_handler () RETURNS OPAQUE AS > '/usr/local/pgsql/lib/pltcl.so' LANGUAGE 'C'; > C

Re: [SQL] FETCH ... INTO in PL/pgSQL

2001-03-15 Thread Jan Wieck
Josh Berkus wrote: > Tom, Bruce, > >Is there any way to make use of the contents of a cursor in a PL/pgSQL > function? FETCH ... INTO isn't supported, according to the docs. Can I > use the dot notation, or something similar? PL/pgSQL doesn't support cursors at all. That's basically a

Re: [SQL] creating "job numbers"

2001-03-22 Thread Jan Wieck
postgresql wrote: > How are you professionals handling this problem? I like the ability to > insert and have the system give me the number. As I grow into more > workstations inputting the jobs I won't have to worry about chasing > the next highest number. Two possible ways: 1. If you

Re: [SQL] creating "job numbers"

2001-03-23 Thread Jan Wieck
postgresql wrote: > Jan, > > Thanks, I must be missing something here. Bear with me, I am > trying to form an intelligent question. > > Using the serial data type... I don't understand when the backend > would skip a number. > If the db is assigning the number with the insert, then if two (or > mo

Re: [SQL] trigger output to a file

2001-03-23 Thread Jan Wieck
pgsql-sql wrote: > Hello Everyone, > > Here's my simple question. > > I just want to know/get the recent changes made to a table. > Deeper? I wanted the Postgresql server to *publish* every > changes made to a table (similar to replication, incremental transfer, > etc.). > What is the best way to

Re: [SQL] all views in database broken at once

2001-03-25 Thread Jan Wieck
Tom Lane wrote: > Andrew Perrin <[EMAIL PROTECTED]> writes: > > But I'm intrigued: what is it that causes this? Is it *my* > > recreating the view on which the other views depend, > > Yes. You dropped and recreated the view --- the new version may have > the same name but it's not the same OID, s

Re: [SQL] all views in database broken at once

2001-03-27 Thread Jan Wieck
Mathijs Brands wrote: > On Sat, Mar 24, 2001 at 11:36:56PM -0500, Tom Lane allegedly wrote: > > Mathijs Brands <[EMAIL PROTECTED]> writes: > > > How about being able to recompile them (keeping the SQL around in the > > > system catalogs)? Doesn't Oracle allow you to do something like that? > > > >

Re: [SQL] Functions and Triggers

2001-03-27 Thread Jan Wieck
Cedar Cox wrote: > > CREATE FUNCTION lastupdated() RETURNS opaque AS ' > begin > new.last_updated := CURRENT_TIMESTAMP; > return new; > end; > ' LANGUAGE 'plpgsql'; > > CREATE TRIGGER trigname BEFORE INSERT OR UPDATE on tblname > FOR EACH ROW EXECUTE PROCEDURE lastupdated(); > > Note: you co

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

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

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

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

[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

[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

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

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

  1   2   >