Re: [GENERAL] not quite expected behaviour when using IN clause

2005-09-30 Thread Stephan Szabo
On Fri, 30 Sep 2005, Joe Maldonado wrote: > Hello all, > > I apologize for the wide distribution but we recently ran into an > interesting behaviour using PostgreSQL 8.0.3 and did not know whether this > was a bug or intended behaviour. > > When an IN clause contains a NULL value the entire in cla

Re: [GENERAL] multiple default values specified for column?

2005-10-07 Thread Stephan Szabo
On Fri, 7 Oct 2005 [EMAIL PROTECTED] wrote: > Hello pgsql is complaining and I can't seem to figure out what the > error is talking about. > Basically it's claiming that multiple default vaues are being > specified, but nowhere in statement below is there one single place > where I can see an erro

Re: [GENERAL] Unique index with Null value in one field

2005-10-11 Thread Stephan Szabo
On Tue, 11 Oct 2005, Hrishi Joshi wrote: > I need to define a Unique index on 3 non-PK fields (composite key) on my > table in PostgreSQL 8.0.3. > > The problem is, if any of those 3 fields is Null, PostgreSQL allows > duplicate rows to be inserted. While searching through archives, I found > mor

Re: [GENERAL] searching array

2005-10-17 Thread Stephan Szabo
On Mon, 17 Oct 2005, Matthew Peter wrote: > Thanks for the reply. I'm using 8.0.3. I'm using > something similiar to the example you gave. My > postgresql install is on offline developement box and > I would have to type it all out longhand. > > Shouldn't >= also return Carols records since she >

Re: [pgsql-advocacy] [GENERAL] Oracle buys Innobase

2005-10-19 Thread Stephan Szabo
On Wed, 19 Oct 2005, Dann Corbit wrote: > Yes, clearly that is the wrong result according to the SQL standard. > > Here is a SQL*Server query: > select 1 where 'a' = 'a ' AND 'a' = 'a ' AND 'a ' = 'a ' > > It returns (correctly): 1 Doesn't that depend on the collating sequence in use, or

Re: [HACKERS] 'a' == 'a ' (Was: RE: [pgsql-advocacy] [GENERAL] Oracle

2005-10-19 Thread Stephan Szabo
On Wed, 19 Oct 2005, Dann Corbit wrote: > > -Original Message- > > From: Terry Fielder [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, October 19, 2005 2:05 PM > > To: Dann Corbit > > Cc: Tino Wildenhain; Marc G. Fournier; [EMAIL PROTECTED]; > > pgsql-hackers@postgresql.org; pgsql-general@p

Re: [GENERAL] a stored procedure ..with integer as the parameter

2005-10-21 Thread Stephan Szabo
On Fri, 21 Oct 2005, surabhi.ahuja wrote: > i have a stored procedure > > insert_table(integer) > which does "insert into table (x) value ($1)"; > > now in my client i call the stored procedure as > > select insert_table("3"); > > it works fine and inserts 3 into the table > > but suppose i give

Re: [GENERAL] a stored procedure ..with integer as the parameter

2005-10-24 Thread Stephan Szabo
your first mail, there was a question of ('') which is not a valid integer. Calling insert('200', 'surabhi', '') or insert('', 'surabhi', '10') are going to give the "invalid input syntax for integer" because an empty string d

Re: [GENERAL] Best way to use indexes for partial match at

2005-11-11 Thread Stephan Szabo
On Fri, 11 Nov 2005, Andrus wrote: > >> SELECT * FROM foo WHERE bar::CHAR(3)='ABC'; > > > Your query is the same as using LIKE, so why not express it that way? > > I want simply to select by first 3 characters. LIKE is too powerful and > unnessecary. LIKE requires > escaping % and ? characters in

Re: [GENERAL] Outer join with where conditions

2005-11-14 Thread Stephan Szabo
On Mon, 14 Nov 2005, [ISO-8859-2] Micha? Otroszczenko wrote: > I wonder If I could move additional join condition from ON part of > query to where part. > > For example instead of: > > SELECT * FROM > booking_load AS bload > LEFT OUTER JOIN dict_load_type_tsl AS load_tsl ON ( >

Re: [GENERAL] Weird results when using schemas

2005-11-20 Thread Stephan Szabo
On Mon, 21 Nov 2005, Geert Jansen wrote: > I'm experiencing some weird results with SELECT queries when I recently > switched to using schemas. Basically, the same query works OK when I set > my search_path to include the schema, but it doesn't when I qualify the > tables in my query. > > One quer

Re: [GENERAL] text to point conversion not working. ( cannot cast

2006-09-28 Thread Stephan Szabo
On Wed, 27 Sep 2006, Dan Libby wrote: > Background: > > I have a hierarchical table where I have coordinate data for only the leaf > nodes. I therefore want to find the center of all the leaf nodes under a > given parent node, and set the parent node coordinate to that center point. > > I can cal

Re: [GENERAL] Normal vs Surrogate Primary Keys...

2006-10-01 Thread Stephan Szabo
On Sun, 1 Oct 2006, rlee0001 wrote: > I know, for example, that by default PostgreSQL assigns every record a > small unique identifier called an OID. It seems reasonable then, that > when the DBA creates a cascading foreign key to a record, that the DBMS > could, instead of storing the record's en

Re: [GENERAL] c (lowercase) privilege

2006-10-20 Thread Stephan Szabo
On Fri, 20 Oct 2006, Javier Carlos wrote: >Does anybody know what's the meaning of the c (lowercase) privilege in > PostgreSQL 8.2 Beta? That should be for CONNECT privilege. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] Wrong record type - caused by SELECT order ???

2006-10-27 Thread Stephan Szabo
On Fri, 27 Oct 2006, John Cobo wrote: > I am trying to create some functions which return many rows using > plpgsql. This example could be done with SQL, but later I will need > plpglsql. I was constantly getting the wrong record type error with a > couple different functions. Finally I found t

Re: [GENERAL] Deleting Problem

2006-10-30 Thread Stephan Szabo
On Tue, 31 Oct 2006, Jamie Deppeler wrote: > Here is my problem > > I have a level structure which is 5 levels deep with 6 tables, for this > example i will call it table1,table2,table3,table4,table5,table6 > > (1)table1 > (2)table2 > (3)table3 > (4)table4 > (5)table5,table6 > (6)table7,table8 >

Re: [GENERAL] Simple stored procedure examples?

2006-11-04 Thread Stephan Szabo
On Fri, 3 Nov 2006, novnov wrote: > I'm completely new to pgsql, using 8.1 and pgAdmin III. I'm not finding a lot > of bare bones simple example stored procs that I can learn from. It would be > very helpful if someone could show me some simple code. > > In the pgAdmin interface I've been picking

Re: [GENERAL] Simple stored procedure examples?

2006-11-04 Thread Stephan Szabo
On Sat, 4 Nov 2006, novnov wrote: > > Thanks to both of you for responding. I should have included the code for my > own attempt, at #1 which is just as you suggest: > > update item set itemname = 'fox'; > > I've tried single, and double quoting the table and field names; call caps > to the UPDATE

Re: [GENERAL] I'm lost :-( with FOR...IN

2006-11-07 Thread Stephan Szabo
On Tue, 7 Nov 2006, Alain Roger wrote: > Hi, > > I' still with my stored procedure : > > -- Function: SP_U_001(typeofarticle varchar) > > -- DROP FUNCTION SP_U_001(typeofarticle varchar); > > CREATE OR REPLACE FUNCTION SP_U_001(IN typeofarticles VARCHAR) > RETURNS SETOF active_articles AS > $BO

Re: [GENERAL] Functional Index

2006-11-22 Thread Stephan Szabo
On Wed, 22 Nov 2006, Alexander Presber wrote: > Hello everybody, > > I am trying to speed up a query on an integer column by defining an > index as follows > > > CREATE INDEX idx_main_subject ON pdb.main (lower(main_subject::text) > using varchar_ops); > > on column "main_subject". > > I had hope

Re: [GENERAL] Multi-column constraint behaviour

2007-01-16 Thread Stephan Szabo
On Tue, 16 Jan 2007, Bertram Scharpf wrote: > Hi, > > > please have a look at these introducing statements: > > sandbox=# create table q(i integer, t text, primary key (i,t)); > sandbox=# create table f(i integer, t text, foreign key (i,t) references q); > > Now, this is surprising me: > > s

Re: [GENERAL] can't CREATE TRIGGER

2007-01-21 Thread Stephan Szabo
On Mon, 22 Jan 2007, gustavo halperin wrote: > I can't create triggers, when I call for example: > ficha=> CREATE TRIGGER TRG_persons_id AFTER INSERT ON ficha_ofperson > ficha-> EXECUTE PROCEDURE add_person_id ( 'family_id', 'person_id' ); > > , the creation never finish and finally, after many m

Re: [GENERAL] invalid regular expression: invalid backreference number

2007-02-18 Thread Stephan Szabo
On Sun, 18 Feb 2007, Jeff Ross wrote: > Tom Lane wrote: > > > > Since ceil() produces float8 which does not implicitly cast to int, > > this call has probably never done what you thought --- AFAICS it will > > cast all the arguments to text and invoke substring(text,text,text) > > which treats its

Re: [GENERAL] invalid input syntax for integer: "NULL"

2007-02-20 Thread Stephan Szabo
On Tue, 20 Feb 2007, Yonatan Ben-Nes wrote: > Hi everyone, > > I'm trying to write a PL/pgSQL function which execute an insert, I encounter > a problem when I try to insert NULL value into an integer field. > The following code is for reproducing: > > CREATE TABLE test( > bh INT8 > ); > > CREATE O

Re: [GENERAL] complex referential integrity constraints

2007-02-22 Thread Stephan Szabo
On Thu, 22 Feb 2007, Joris Dobbelsteen wrote: > >-Original Message- > >From: [EMAIL PROTECTED] > >[mailto:[EMAIL PROTECTED] On Behalf Of > >Martijn van Oosterhout > >Sent: donderdag 22 februari 2007 18:17 > >To: Joris Dobbelsteen > >Cc: Robert Haas; pgsql-general@postgresql.org > >Subject:

Re: [GENERAL] complex referential integrity constraints

2007-02-23 Thread Stephan Szabo
On Fri, 23 Feb 2007, Joris Dobbelsteen wrote: > >-Original Message- > >From: Martijn van Oosterhout [mailto:[EMAIL PROTECTED] > >Sent: vrijdag 23 februari 2007 9:50 > >To: Joris Dobbelsteen > >Cc: pgsql-general@postgresql.org > >Subject: Re: [GENERAL] complex referential integrity constra

Re: [GENERAL] [Bulk] Re: quoted identifier behaviour

2007-03-14 Thread Stephan Szabo
On Wed, 14 Mar 2007, Randall Smith wrote: > Scott Marlowe wrote: > > This whole discussion is reminding me of one of my personal mantras, and > > that is that relying on "artifacts" of behaviour is generally a bad > > idea. > > > > For instance, many databases accept != for not equal, but the sql

Re: [GENERAL] [Bulk] Re: quoted identifier behaviour

2007-03-15 Thread Stephan Szabo
On Wed, 14 Mar 2007, Randall Smith wrote: > Stephan Szabo wrote: > > On Wed, 14 Mar 2007, Randall Smith wrote: > > > >> Scott Marlowe wrote: > >>> This whole discussion is reminding me of one of my personal mantras, and > >>> that is that relyin

Re: [GENERAL] deleting a foreign key that has no references

2007-03-19 Thread Stephan Szabo
On Mon, 19 Mar 2007, Glen W. Mabey wrote: > Hello, > > I'm using 8.1.8, and I have a situation where a record in one table is > only meaningful when it is referenced via foreign key by one or more > records in any one of several tables. > > So, really what I want is when one of the referring recor

Re: [GENERAL] Order by behaviour

2007-03-28 Thread Stephan Szabo
On Wed, 28 Mar 2007, Carlos H. Reimer wrote: > Hi, > > We have a PostgreSQL 8.0.6 cluster configured with lc_collate=pt_BR.UTF-8 > and when we run the following SELECT: > SELECT substr(nomerazao,1,4), > ascii(substr(nomerazao,1,1)), > ascii(substr(nomerazao,2,1)) > from spunico.unico order by nome

Re: RES: [GENERAL] Order by behaviour

2007-03-29 Thread Stephan Szabo
On Thu, 29 Mar 2007, Carlos H. Reimer wrote: > Humm, ok, it is clear now. > > And is there a way to change something in this behaviour, like not ignore > spaces and some type of symbols? Well, right now it's generally determined by your OS's definition of the locale you've chosen. You might be ab

Re: [GENERAL] How to disable duplicate columns

2007-04-09 Thread Stephan Szabo
On Sun, 8 Apr 2007, Andrus wrote: > I have tables with large number of columns some of which are duplicate. > I need to use > > SELECT t1.*, t2.* FROM t1 join t2 using (t) > > since I don't know all column names of t1 and t2 tables at design time. > > In this case PostgreSQL returns table with du

Re: [GENERAL] Lock contention, docs vs. reality

2007-04-22 Thread Stephan Szabo
On Sun, 22 Apr 2007, Roland Turner wrote: > I'm working with 7.4, but the 8.2 docs[1] have the same apparent error: > > ROW SHARE > > Conflicts with the EXCLUSIVE and ACCESS EXCLUSIVE lock modes. > > The SELECT FOR UPDATE and SELECT FOR SHARE commands acquire a > lock of th

Re: [GENERAL] text + text

2004-10-08 Thread Stephan Szabo
On Fri, 8 Oct 2004, David Garamond wrote: > Peter Eisentraut wrote: > >>What is "text + text" supposed to do right now? > > > > Nothing. > > Then are these bugs? (7.4.5 and 8.0.0beta1 give same results). Frankly, > the current behaviour is quite strange to me. > > -- > =# select co

Re: [GENERAL] Numeric user names

2004-10-18 Thread Stephan Szabo
On Tue, 12 Oct 2004, Ed Stoner wrote: > I am unable to use the "CREATE USER" command with numeric user names > (i.e. CREATE USER 35236 WITH PASSWORD '1234';). Is this a limitation or > a problem somewhere with how I have things configured? Is there are > workaround? I believe you can create a

Re: [GENERAL] Where clause limited to 8 items?

2004-10-19 Thread Stephan Szabo
On Wed, 20 Oct 2004, Henry Combrinck wrote: > Hello > > Searched around, but could not find this mentioned. > > I've noticed the following behaviour in 7.4.5: > > [explain analyse] select * from foo where > col1 = 1 or > col1 = 2 or > col1 = 3 or > col1 = 4 or > col1 = 5 or > col1 = 6 or > col1 =

Re: [GENERAL] FKs and deadlocks

2004-10-22 Thread Stephan Szabo
On Fri, 22 Oct 2004, Philippe Lang wrote: > I have tried to correct that by adding a "SET CONSTRAINTS ALL DEFERRED" > in every trigger and function, hoping it would solve my problem. Maybe > it helped, but it did not solve anything. Note that set constraints all deferred does nothing unless you m

Re: [GENERAL] Bug or stupidity

2004-10-23 Thread Stephan Szabo
On Sat, 23 Oct 2004, Philip Hofstetter wrote: > > As for what's SQL standard, I think by a strict definition your query > > shouldn't be allowed at all, referencing an undefined table. > > This is exactly what I think too. I mean: I know I made an error in my > query. It would just have been easie

Re: [GENERAL] OID's

2004-10-23 Thread Stephan Szabo
On Sat, 23 Oct 2004, Leen Besselink wrote: > Eddy Macnaghten zei: > > I think you are correct in not using OIDs, as, firstly, as you point out > > they are optional, also that they are not neccessarily unique. > > > > I'm sorry Eddy, but you most be mistaken: > > Every row in POSTGRESQL is assigne

Re: [GENERAL] Bug or stupidity

2004-10-25 Thread Stephan Szabo
On Mon, 25 Oct 2004, Thomas Hallgren wrote: > Stephan Szabo wrote: > > > It's enabled in large part for backwards compatibility. There's a > runtime > > option that controls the behavior (add_missing_from). > > > IMHO, it would be a more natural choice

Re: [GENERAL] Any plans on allowing user-defined triggers to be

2004-10-26 Thread Stephan Szabo
On Tue, 26 Oct 2004, Mike Mascari wrote: > I'd like to ensure that the creation of a department also implies the > creation of two to eight projects; no more, no less: > > CREATE TABLE departments ( > department text primary key not null > ); > > CREATE TABLE projects ( > project text primary k

Re: [GENERAL] Bug or stupidity

2004-10-26 Thread Stephan Szabo
On Mon, 25 Oct 2004, Thomas Hallgren wrote: > Stephan, > > > In general, when we add a backwards compatibility option, we give > > a couple of versions before the default is changed. > > > Perhaps the 8.0 would be a perfect time since it's a change of the major > number. Maybe, but I think it'

Re: [GENERAL] Any plans on allowing user-defined triggers to be

2004-10-26 Thread Stephan Szabo
On Tue, 26 Oct 2004, Mike Mascari wrote: > Stephan Szabo wrote: > > On Tue, 26 Oct 2004, Mike Mascari wrote: > > > > > >>I'd like to ensure that the creation of a department also implies the > >>creation of two to eight projects; no more, no less: >

Re: [GENERAL] Any plans on allowing user-defined triggers to be

2004-10-26 Thread Stephan Szabo
On Tue, 26 Oct 2004, Mike Mascari wrote: > Stephan Szabo wrote: > > On Tue, 26 Oct 2004, Mike Mascari wrote: > > > > > >>I'd like to ensure that the creation of a department also implies the > >>creation of two to eight projects; no more, no less

Re: [GENERAL] Temporarily disable rule, is this possible?

2004-11-07 Thread Stephan Szabo
[EMAIL PROTECTED] ("Net Virtual Mailing Lists") wrote: >CREATE OR REPLACE RULE sometable_delete ON DELETE DO delete FROM cache >WHERE tablename='sometable'; >CREATE OR REPLACE RULE sometable_insert ON INSERT DO delete FROM cache >WHERE tablename='sometable'; >CREATE OR REPLACE RULE sometable_updat

Re: [GENERAL] subselect, order by and left join

2004-11-08 Thread Stephan Szabo
On Mon, 8 Nov 2004, Morten K. Poulsen wrote: > Please let me know if this is not the list to ask this kind of question. > > I am trying to optimize a query that joins two relatively large (75 rows > in > each) tables. If I do it using a subselect, I can "force" the planner to > choose > the

Re: [GENERAL] Modifying FK constraints

2004-11-10 Thread Stephan Szabo
On Wed, 10 Nov 2004, Oleg Lebedev wrote: > Is it possible to modify a foreign key constraint and force it to > cascade on update? If there is no such SQL command, then is it possible > to update some system tables to accomplish this? > > The problem is that I have a bunch of tables with FK constra

Re: [GENERAL] Modifying FK constraints

2004-11-11 Thread Stephan Szabo
On Wed, 10 Nov 2004, Oleg Lebedev wrote: > > In order to find all FK declared on a table I query tg_trigger view. The > query lists all FKs declared on the table as well as all the ones > referencing the table. I noticed that FKs that are declared on the table > have pgtype equal to 21, and FKs re

Re: [GENERAL] OID Question

2004-11-11 Thread Stephan Szabo
On Thu, 11 Nov 2004, Terry Lee Tucker wrote: > Is it ok to put a unique index on the oid for my tables? We are in the process > of moving from Progress Software to PostgreSQL. In the Progress world, you > can always uniquely, and quickly find a record by using their version of oid, > which is reci

Re: [GENERAL] simple query question: return latest

2004-11-11 Thread Stephan Szabo
On Thu, 11 Nov 2004, Scott Frankel wrote: > > On Nov 11, 2004, at 5:09 PM, Michael Glaesemann wrote: > > > Scott, > > > > On Nov 12, 2004, at 10:00 AM, Scott Frankel wrote: > > > >> color | date > >> + > >> red| 2004-01-19 > >> blue | 2004-05-24 > >> red| 2004-04-

Re: [GENERAL] Mysterious Death of postmaster (-9)

2004-11-13 Thread Stephan Szabo
On Sat, 13 Nov 2004, Gregory S. Williamson wrote: > Looking in the logs I see: > 2004-11-13 13:30:28 LOG: unexpected EOF on client connection > 2004-11-13 13:30:40 LOG: unexpected EOF on client connection > 2004-11-13 13:38:28 LOG: could not send data to client: Broken pipe > 2004-11-13 13:42:1

Re: [GENERAL] Last value inserted

2004-11-16 Thread Stephan Szabo
On Tue, 16 Nov 2004, Jeff Eckermann wrote: > --- Jerry III <[EMAIL PROTECTED]> wrote: > > > Which means that sometimes they do not return the > > correct value - if you > > have a trigger that inserts another record you will > > not get the right value. > > If you are new to PostgreSQL, as you sa

Re: [GENERAL] index and queries using '<' '>'

2004-11-19 Thread Stephan Szabo
On Fri, 19 Nov 2004, Marc Boucher wrote: > At 16:23 18/11/2004 +0100, Martijn van Oosterhout wrote: > > The system seems to think that a scan is cheap because the table is so > > small. > The table currently contains just over 1 elements. So 238 rows is a > small part of it. > > > Have you ev

Re: [GENERAL] Delete very slow after deletion of many rows in

2004-11-21 Thread Stephan Szabo
On Sun, 21 Nov 2004, Cornelius Buschka wrote: > Hi, > > we saw the following problem: > > We deleted all rows from a table B referencing table A (~50 records). No > problem, but the following try to delete all records from table A (~18) > lead > to a "never ending" statement. We found ou

Re: [GENERAL] Upcoming Changes to News Server ...

2004-11-23 Thread Stephan Szabo
On Tue, 23 Nov 2004, Gary L. Burnore wrote: > At 07:47 PM 11/23/2004, [EMAIL PROTECTED] wrote: > > > -Original Message- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] Behalf Of Jim Seymour > > > Sent: Tuesday, November 23, 2004 5:18 PM > > > To: [EMAIL PROTECTED] > > > Subj

Re: [GENERAL] Table name as parameter in function

2004-11-23 Thread Stephan Szabo
On Tue, 23 Nov 2004, Timothy Perrigo wrote: > Sorry for the brief response earlier; I was a bit rushed. After > looking into it, it's a bit messier than I thought (at least, as far as > I can tell...perhaps one of the gurus on this list can show us a better > way). > > Ordinarily, when you write

Re: [GENERAL] SERIAL error

2004-11-27 Thread Stephan Szabo
On Sat, 27 Nov 2004 [EMAIL PROTECTED] wrote: > > I'm using v. 7.4.2, and am encountering a problem with serial types. On an > insert into a table that results in failure for any number of reasone (mostly > violation of contraints) I've found that the Sequence for the column of type > serial will

Re: [GENERAL] sequencing two tables

2004-11-28 Thread Stephan Szabo
On Sun, 28 Nov 2004, Shachar Shemesh wrote: > I need to create a list of all rows of the combination of two tables. > For reasons I can't go into, I need this list to be in a single query, > and not write a function to do it. > > I thought about doing something like this: > select |COALESCE(table1

Re: [GENERAL] Trigger problem

2004-12-04 Thread Stephan Szabo
On Sat, 4 Dec 2004, Henry Molina wrote: > drop table t1; > drop table t2; > create table t1 (id integer); > create table t2 (id integer); > CREATE OR REPLACE FUNCTION myfunc() RETURNS trigger AS ' > BEGIN > insert into t2 values(NEW.id); > END; > ' LANGUAGE plpgsql; > > CREATE TRIGGER >

Re: [GENERAL] triggers, transactions and locks

2004-12-06 Thread Stephan Szabo
On Mon, 6 Dec 2004, C G wrote: > Is there a way to use locks within a trigger? My example below gives the > error: It's not the lock that's the problem I think. The begin work is failing because you can't start a transaction inside the function. Were you trying to release the lock at the commit

Re: [GENERAL] Index scan vs. Seq scan on timestamps

2004-12-06 Thread Stephan Szabo
On Mon, 6 Dec 2004, Per Jensen wrote: > select count(*) > from accesslog > where time between (timeofday()::timestamp - INTERVAL '30 d') and > timeofday()::timestamp; Besides the type issue, timeofday() is volatile and thus is not allowed to be turned into a constant in order to do an index sca

Re: [GENERAL] Triggers don't activate when dropping table

2004-12-07 Thread Stephan Szabo
On Tue, 7 Dec 2004, cheng shan wrote: >In the first version, the function destroy_object_type( ) just drop the >table only. But when I find the triggers havn't >been actived yet, I add the delete setense. This time it becomes even >worse, the system throws error message.ERROR: could >not open r

Re: [GENERAL] Index scan vs. Seq scan on timestamps

2004-12-07 Thread Stephan Szabo
On Mon, 6 Dec 2004, Stephen Frost wrote: > * Stephan Szabo ([EMAIL PROTECTED]) wrote: > > On Mon, 6 Dec 2004, Per Jensen wrote: > > > select count(*) > > > from accesslog > > > where time between (timeofday()::timestamp - INTERVAL '30 d') and >

Re: [GENERAL] Query is not using index when it should

2004-12-10 Thread Stephan Szabo
On Fri, 10 Dec 2004, Tomas [iso-8859-1] Skäre wrote: > I have a table that looks like this: > > Table "public.cjm_object" > Column | Type| Modifiers > ---+---+--- > timestamp | bigint| not null > jobid | bigint

Re: [GENERAL] Checking inequality

2004-12-11 Thread Stephan Szabo
On Sat, 11 Dec 2004, Vitaly Belman wrote: > I have the following code in one of my trigger functions > > --- > IF old.series_id<>new.series_id THEN > ... > ... > END IF; > --- >

Re: [GENERAL] 'distinct on' and 'order by' conflicts of interest

2004-12-31 Thread Stephan Szabo
On Fri, 31 Dec 2004 [EMAIL PROTECTED] wrote: > It has come up several times on the various postgresql lists that in order > to get around the requirement of DISTINCT ON parameters matching the first > ORDER BY parameters, wrap the distinct query in a new 'order by' query: > > select * from (selec

Re: [GENERAL] multi column index and order by

2005-01-05 Thread Stephan Szabo
On Wed, 5 Jan 2005, Mage wrote: > "order by a asc b desc" > > how can I create an index for this? You need to create an operator class for reversed comparison of whatever type b is and then use it on b in the index definition. Something like (however, you should really use a C function for the

Re: [GENERAL] Interval Question

2005-01-11 Thread Stephan Szabo
On Tue, 11 Jan 2005, Terry Lee Tucker wrote: > As you can see, this truck is going to be 2 hours late. The return value I'm > looking for is the difference between Appt. Interval and Travel Interval, as > in: return (appt_interval - travel_interval). This value will be stored in a > column of ty

Re: [GENERAL] index on user defined type

2005-01-12 Thread Stephan Szabo
On Wed, 12 Jan 2005, Tom Lane wrote: > Jeff Davis <[EMAIL PROTECTED]> writes: > > I think I created a type that was compatible with the btree index, and > > everything seems fine, except that it doesn't actually use the index. I > > created the operators and the opclass as well. > > > => explain s

Re: [GENERAL] Functions returning RECORD

2005-01-13 Thread Stephan Szabo
On Thu, 13 Jan 2005, Craig Bryden wrote: > When I run select * from GetAccountInfo (100) > I get the following error message: ERROR: a column definition list is > required for functions returning "record" You need to say something like: select * from GetAccountInfo(100) AS foo(field1 int, fiel

Re: [GENERAL] Unique Index

2005-01-19 Thread Stephan Szabo
On Thu, 20 Jan 2005, Alex wrote: > i have a unique index on a table over multiple columns. If now one of > the records has a null value in one of the indexed columns i can insert > the same record multiple times. > > Is this a problem within postgres or expected? Expected. NULLs are effectively

Re: [GENERAL] Unique Index

2005-01-19 Thread Stephan Szabo
On Wed, 19 Jan 2005, Dann Corbit wrote: > Even at that, I think that being able to insert more than one null value > into a unique index should be considered as a bug (or diagnosed as an > error). AFAICT the UNIQUE constraint that it's used to model explicitly allows multiple NULLs in the spec s

Re: [GENERAL] Unique Index

2005-01-19 Thread Stephan Szabo
ent so giving the unique index behavior which makes it unable to model the constraint wouldn't be terribly workable (without rewriting the constraint to be modeled in a separate fashion). > -Original Message- > From: Stephan Szabo [mailto:[EMAIL PROTECTED] > Sent: Wednesday, J

Re: [GENERAL] Unique Index

2005-01-19 Thread Stephan Szabo
On Wed, 19 Jan 2005, Stephan Szabo wrote: > > On Wed, 19 Jan 2005, Dann Corbit wrote: > > > True, but the standard says nothing about the creation of an index, so > > you can make it behave in any way that you see fit. > > The unique index is however used to mod

Re: [GENERAL] Unique Index

2005-01-20 Thread Stephan Szabo
On Thu, 20 Jan 2005, Dann Corbit wrote: > It is clear to me that only allowing a single null value will not > violate the explanation below. Given two rows in T with one column each (NULL), (NULL) Find two rows such that the value of each column in one row is non-null and equal to the value of

Re: [GENERAL] Unique Index

2005-01-20 Thread Stephan Szabo
On Thu, 20 Jan 2005, Dann Corbit wrote: > Would the constraint not be satisfied if each combination (including > NULL) were not also forced to be unique? The constraint would be satisfied, however cases that the constraint is satisfied for would not be allowed. The case I gave below is one for w

Re: [GENERAL] on update / on delete performance of foreign keys

2005-01-24 Thread Stephan Szabo
On Mon, 24 Jan 2005, Florian G. Pflug wrote: > Since postgres already incoporates code to check foreign keys more > efficiently (when doing alter table ... add constraint .. foreign key, > postgres seems to use a merge or a hash join, instead of a nested loop), > I wondered how hard it would be t

Re: [GENERAL] on update / on delete performance of foreign keys

2005-01-24 Thread Stephan Szabo
On Mon, 24 Jan 2005, Florian G. Pflug wrote: > Stephan Szabo wrote: > > On Mon, 24 Jan 2005, Florian G. Pflug wrote: > > > >>Since postgres already incoporates code to check foreign keys more > >>efficiently (when doing alter table ... add constraint .. foreign

Re: [GENERAL] on update / on delete performance of foreign keys

2005-01-24 Thread Stephan Szabo
On Tue, 25 Jan 2005, Florian G. Pflug wrote: > Stephan Szabo wrote: > > > It's not sufficient to do the delete for non existant pk rows in the > > deferred case. I also think we'd need to decide on the behavior for the > > PostgreSQL case where a user trigger

Re: [GENERAL] Object Relational, Foreign Keys and Triggers

2005-01-25 Thread Stephan Szabo
On Mon, 24 Jan 2005, Alex Turner wrote: > Insert fails with a foreign key constraint error because entity_phone > points to entity, not person, and the rows aren't physicaly in entity, > they are in person. > > Two questions: > 1) Why can't we make this work the 'right' way - not doing so either >

Re: [GENERAL] Apparently I don't understand full outer joins....

2005-01-25 Thread Stephan Szabo
On Tue, 25 Jan 2005, Ben wrote: > I run this: > > select > coalesce(a.n,0) as a, > coalesce(b.n,0) as b, > coalesce(a.s,b.s) as s > from > ( select 1 as n, 0 as s) a full outer join > ( select 2 as n, 1 as s) b > on > a.s = b.s > > ... and get this: > > a | b |

Re: [GENERAL] [SQL] Foreign Key relationship between two databases

2005-01-27 Thread Stephan Szabo
On Thu, 27 Jan 2005, Sandeep Gaikwad wrote: > I can give foreign key relationship between two tables of same > database. Can I give foreign key relationship between tables of two > databases ? Plz, let me know if possible & send me how can I do that? Unfortunately, that's not really current

Re: [GENERAL] rowset-returning function mismatch

2005-01-28 Thread Stephan Szabo
On Fri, 28 Jan 2005, Ed L. wrote: > I ask because it seems like "char" and char should match as type names, > but don't. Unfortunately, "char" and char are actually different types in declarations like that AFAIK. When in quotes it refers to the postgres single byte single character type, IIRC

Re: [GENERAL] Postgres using up all my memory

2005-02-04 Thread Stephan Szabo
On Fri, 4 Feb 2005, Eric Jain wrote: > I'm trying to fill a table with several million rows that are obtained > directly from a complex query. > > For whatever reason, Postgres at one point starts using several > gigabytes of memory, which eventually slows down the system until it no > longer resp

Re: [GENERAL] Sorting when "*" is the initial character

2005-02-07 Thread Stephan Szabo
On Mon, 7 Feb 2005, Berend Tober wrote: > I encountered what looks like unusually sorting behavior, and I'm wondering if > anyone can tell me if this is supposted to happen (and then if so, why) or if > this is a bug: If you ran initdb with a locale such as en_US, a result like what you got is ex

Re: [GENERAL] Apparent anomaly with views and unions

2005-02-11 Thread Stephan Szabo
On Fri, 11 Feb 2005, Guy Rouillier wrote: > I using 8.0.1. I create 3 tables with these definitions: > > create table t1 (serv_id varchar(50) not null); > create table t2 (serv_id varchar(50) not null); > create table t3 (serv_id varchar(50) not null); > > Now I create a view like this: > > crea

Re: [GENERAL] possible bug with compound index.

2005-02-13 Thread Stephan Szabo
On Mon, 14 Feb 2005, Neil Dugan wrote: > I am using PostgreSQL 7.4.7 > I have a table with serveral fields two of these are a serialno > (bigserial) and name(varchar). I have created two indexs on these > fields. > 1) on name > 2) on name,serialno > if I use the command > 'select * from t

Re: [GENERAL] problem with dots in order by

2005-02-15 Thread Stephan Szabo
On Tue, 15 Feb 2005, Ruben Oliveira wrote: > Hello everybody ! > > I have this order by : > select lalala from tablex order by field_y; > where field_y is a text column. > > that returns something like : > 2.1004.11 > 21.00.461 > 2.1006.21 > > in PostgreSQL 7.3.2 in Linux Mandrake 9.1 > > but in

Re: [GENERAL] ERROR: cannot alter type of a column used by a view

2005-02-16 Thread Stephan Szabo
On Wed, 16 Feb 2005, Daniel Naschenweng wrote: > I create this table: > create table teste (campo1 varchar(20)); > > And this view: > create view vteste as select * from teste; > > When I try change the type of the column raise thir error: > db=# alter table teste alter column campo1 type varchar(

Re: [GENERAL] Deadlock Detected (revisited)

2005-11-25 Thread Stephan Szabo
On Fri, 25 Nov 2005, Wes wrote: > I haven't seen anything to indicate that 8.x improves foreign key > refererence locking and fixes the foreign key 'deadlock detected' issue. > Has that been addressed in 8.1? 8.1 should be using the new shared row locks for doing the checks. This should fix the

Re: [GENERAL] Deadlock Detected (revisited)

2005-11-25 Thread Stephan Szabo
On Fri, 25 Nov 2005, Wes wrote: > On 11/25/05 2:40 AM, "Stephan Szabo" <[EMAIL PROTECTED]> wrote: > > > 8.1 should be using the new shared row locks for doing the checks. This > > should fix the case mentioned. > > Hmm. I'm looking in the "Wha

Re: [GENERAL] deadlock detected - when multiple threads try to update

2005-12-02 Thread Stephan Szabo
On Fri, 2 Dec 2005, Harakiri wrote: > im using postgresql 8 under SLES 9 and RH 3.x - under > both OS i encountered the following problem : > > Lets say i have a table, which has no reference to any > other table - and i create one entry for each day of > the year within this table (PK). During a

Re: [GENERAL] deadlock detected - when multiple threads try to update

2005-12-03 Thread Stephan Szabo
On Fri, 2 Dec 2005, Harakiri wrote: > Hi, thanks for the response , > > > > > It's hard to say with just the above. Are you doing > > other things in the > > transactions besides a single update of that table > > and/or is the order of > > in each transaction i do basically the same stuff : > > in

Re: [GENERAL] Performance woes

2005-12-10 Thread Stephan Szabo
On Sat, 10 Dec 2005, Benjamin Smith wrote: > A few questions: > > 1) Let's assume that I have some multipile foreign keys, and I join on three > values. For example: > > Create table gangsters ( > name varchar not null, > birthdate integer not null, > shirtnumber integer not nul

Re: Bug#342369: [GENERAL] PostgreSQL 8.1.0 RHEL / Debian incompatible

2005-12-13 Thread Stephan Szabo
On Tue, 13 Dec 2005, Anand Kumria wrote: > On Mon, Dec 12, 2005 at 09:41:47AM +0100, Richard van den Berg wrote: > > Tom Lane wrote: > > > You've got that 100% backwards: you should be complaining to Debian that > > > it's not their business to editorialize on the default setting. > > Actually it

Re: Bug#342369: [GENERAL] PostgreSQL 8.1.0 RHEL / Debian incompatible

2005-12-13 Thread Stephan Szabo
On Tue, 13 Dec 2005, Stephen Frost wrote: > * Stephan Szabo ([EMAIL PROTECTED]) wrote: > > > In and of itself it's a good option. However, choosing that option means > > that Debian is saying that compatibility of data files with default > > compiled Postgre

Re: [GENERAL] another problem with stored procedures

2005-12-29 Thread Stephan Szabo
On Thu, 29 Dec 2005, Ted Byers wrote: > I have just encountered another problem. I am not sure if it is with my > code, or with how I am working with Postgres/pgAdmin III. > > Here is another function, as created using the wizard/dialog box in pgAmin > III for creating functions: > > CREATE FUNC

Re: [GENERAL] Delete / F/K error

2005-12-30 Thread Stephan Szabo
On Fri, 30 Dec 2005, Michael Fuhr wrote: > On Fri, Dec 30, 2005 at 02:38:48PM -0800, CSN wrote: > > I'm still confused what the problem was. > > I think the problem is related to having multiple foreign key > constraints with ON DELETE SET NULL referencing the same target. > The triggers that enfo

Re: [GENERAL] "REFERENCES" and UNIQUE

2006-01-04 Thread Stephan Szabo
On Wed, 4 Jan 2006, Michelle Konzack wrote: > > __( 'stdin' )_ > / > | psql:omegasector.sql:125: ERROR: there is no unique constraint matchi > | ng given keys for referenced table "cities" > \_

Re: [GENERAL] "REFERENCES" and UNIQUE

2006-01-04 Thread Stephan Szabo
On Wed, 4 Jan 2006, Stephan Szabo wrote: > Which in this case hints that there's a problem with the schema. > > What is the final effect you're looking for? The above does let you Err, that should be doesn't. > lookup the DE or FR strings for a city of a member (w

<    1   2   3   4   5   6   >