Re: [SQL] My Indices doesn't work

2000-08-15 Thread Stephan Szabo
re is still a read from the heap to check if it's valid). The optimizer seems to think 333 records match num>2. Is this reasonable? Stephan Szabo [EMAIL PROTECTED] On Tue, 15 Aug 2000, Martin Dolog wrote: > Hi *, > > I have pgsql7.0.2 on Linux2.2.16 and table with following indices

Re: [SQL] copy from

2000-08-15 Thread Stephan Szabo
Sort of. You can give the field a default value of nextval() which means that if you do not specify the column in an insert, it automatically gets the default value which should be the next value in the sequence. Note, that not putting the column is different from inserting a NULL into the field

Re: [SQL] PL/PGSQL Function problem.

2000-08-15 Thread Stephan Szabo
d finally, the obligatory upgrade message... Upgrade to 7.0.2 if you can, it's nice and stays crunchy in milk. :) Stephan Szabo [EMAIL PROTECTED] On Tue, 15 Aug 2000, Dirk Elmendorf wrote: > RedHat 6.2 /Postgres 6.53 > I'm still very new at PL/PGSQL but I have looked thru all the &g

Re: [SQL] copy from

2000-08-15 Thread Stephan Szabo
On Tue, 15 Aug 2000, Adam Lang wrote: > Gotcha. Now, if I do an insert and just don't specify that field at all, it > will, use the default value, correct? As long as I don't "touch" the field > with anything it uses the default. Right, as long as you don't specify the field in the column lis

Re: [SQL] Continuous inserts...

2000-08-17 Thread Stephan Szabo
On Thu, 17 Aug 2000, Joerg Hessdoerfer wrote: > Hi! > > I have an application, where I have to insert data into a table at several > rows per second, 24 hours a day, 365 days a year. > > After some period (a week, maybe a month) the data will be reducted to some > degree and deleted from the t

Re: [SQL] Continuous inserts...

2000-08-18 Thread Stephan Szabo
On Fri, 18 Aug 2000, Joerg Hessdoerfer wrote: > Good idea - I immediately tested it - rules rule! That seems to work perfectly, > and the client doesn't even see it happen (except for 'selects', one would > have to setup > a rule to return something meaningful then...). > > I did: > Two tables,

Re: [SQL] update rule loops

2000-08-18 Thread Stephan Szabo
On Fri, 18 Aug 2000, Poul L. Christiansen wrote: > Hi > > I'm trying to make a field in my table (datechanged) to automatically be > updated with the value 'now()' when an update on the table occurs. > > plc=# create rule datechanged_radius AS ON update to radius do update > radius set datecha

Re: [SQL] Beginner problems with functions (Was: Is this the wronglist?)

2000-08-17 Thread Stephan Szabo
On Thu, 17 Aug 2000, Andreas Tille wrote: > On Wed, 16 Aug 2000, Stephan Szabo wrote on [EMAIL PROTECTED]: > (sorry for the crossposting, just to tell the list that I now switched to > the right one hopefully) > > > I think the thing is that most people don't ha

Re: [SQL] Speed or configuration

2000-08-20 Thread Stephan Szabo
(It won't really be forever, just probably a really long time) You can usually get around it by rewriting the query to use EXISTS rather than IN. Stephan Szabo [EMAIL PROTECTED] On Sun, 20 Aug 2000, Franz J Fortuny wrote: > At our company we are presently using a commercial > da

Re: [SQL] Re: Beginner problems with functions

2000-08-21 Thread Stephan Szabo
On Mon, 21 Aug 2000, Andreas Tille wrote: > On Thu, 17 Aug 2000, Stephan Szabo wrote: > > > What you may need to do is declare a variable of type record > > and do SELECT INTO * From ... rather than just > > the SELECT. > Thanks, that worked. > > > Yea

Re: [SQL] Continuous inserts...

2000-08-22 Thread Stephan Szabo
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? Stephan Szabo [EMAIL

Re: [SQL] Question on string value expression wildcarding

2000-08-24 Thread Stephan Szabo
into kp values ('kp.dhs,d'); select * from kp where name like 'kp.dhs.%'; name -- kp.dhs.a kp.dhs. (2 rows) select * from kp where name like 'kp.dhs%'; name ------ kp.dhs.a kp.dhs. kp.dhs,d (3 rows) Stephan Szabo [EMAIL PROTECTED] On T

Re: [SQL] Select subset of rows

2000-08-27 Thread Stephan Szabo
=employee.salary); end; Stephan Szabo [EMAIL PROTECTED] On Sun, 27 Aug 2000, Paulo Roberto Siqueira wrote: > Hi folks, > > I have this table > > CREATE TABLE EMPLOYEE (ID_EMP INT4 PRIMARY KEY, NAME VARCHAR(35), SALARY > NUMERIC(5,2)); > > I want to s

Re: [SQL] Select subset of rows

2000-08-27 Thread Stephan Szabo
On Sun, 27 Aug 2000, Paulo Roberto Siqueira wrote: > Hi folks, > > I have this table > > CREATE TABLE EMPLOYEE (ID_EMP INT4 PRIMARY KEY, NAME VARCHAR(35), SALARY > NUMERIC(5,2)); > > I want to select only the employees' names who have the 5 highest salaries. Well, that depe

Re: [SQL] Select subset of rows

2000-08-27 Thread Stephan Szabo
On Sun, 27 Aug 2000, John McKown wrote: > On Sun, 27 Aug 2000, Stephan Szabo wrote: > > > > > Of course immediately after sending the last message and logging off my > > ISP I figured out the simpler way for the third one: > > > > begin; > > select sa

Re: [SQL] Problems with complex queries ...

2000-08-29 Thread Stephan Szabo
Without seeing the schema or anything, a similar query to your first one appears to run on my Postgres 7.0.2 setup. It's probably worth upgrading. On Wed, 30 Aug 2000, J. Fernando Moyano wrote: > I try this on my system: (Postgres 6.5.2, Linux) > > "select n_lote from pedidos except select rp

Re: [SQL] Create Primary Key?

2000-08-29 Thread Stephan Szabo
We don't currently support the SQL syntax for adding a PK to a table. However, if you have the columns as NOT NULL already, adding a unique index to the columns in question has the same general effect. Stephan Szabo [EMAIL PROTECTED] On Tue, 29 Aug 2000, Webb Sprague wrote: > Aprop

Re: [SQL] Optimizing huge inserts/copy's

2000-08-29 Thread Stephan Szabo
On Tue, 29 Aug 2000, Jie Liang wrote: > Hi, there, > > 1. use copy ... from '.'; > 2. write a PL/pgSQL function and pass multiple records as an array. > > However, if your table have a foreign key constraint, it cannot be speed > up, > > I have same question as you, my table invloving 9-1

Re: [SQL] Create Primary Key?

2000-08-30 Thread Stephan Szabo
On Wed, 30 Aug 2000, D'Arcy J.M. Cain wrote: > Thus spake Stephan Szabo > > We don't currently support the SQL syntax for adding > > a PK to a table. However, if you have the columns > > as NOT NULL already, adding a unique index to the > > columns in

Re: [SQL] Optimizing huge inserts/copy's

2000-08-30 Thread Stephan Szabo
On Wed, 30 Aug 2000, Jie Liang wrote: > Hi, > > I knew that if no constarint, it populate very quick, my question is: > when two tables have been > reloaded, then I want to add a foreign key constraint to it, say: > tableA has primary key column (id) > tableB has a column (id) references it, so

Re: [SQL] Query-ing arrays

2000-09-01 Thread Stephan Szabo
I'd suggest checking the array utilities in contrib. I believe it has functions/operators for element in set. Stephan Szabo [EMAIL PROTECTED] On Fri, 1 Sep 2000, Jon Lapham wrote: > Stupid FAQ probably: > > Is it possible to query an array for an item WITHOUT KNOWING where

Re: [SQL] Cascading Deletes

2000-09-06 Thread Stephan Szabo
I think a references constraint on ID referencing _ID with ON DELETE CASCADE should do what you want. Stephan Szabo [EMAIL PROTECTED] On Wed, 6 Sep 2000, Craig May wrote: > Hi, > > I have a tables having this structure: > > ID (int) | _ID (int) | Name (String) > > &

Re: [SQL] Weighted Searching

2000-09-12 Thread Stephan Szabo
you usually want to be searching where the weight was given if you had the years_experience or greater? Stephan Szabo [EMAIL PROTECTED] On Tue, 12 Sep 2000, Mitch Vincent wrote: > I emailed the list a while back about doing some weighted searching, asking > if anyone had implemented any ki

Re: [SQL] work on some tables in the same time.

2000-09-13 Thread Stephan Szabo
hat does the inserts for you. Stephan Szabo [EMAIL PROTECTED] On Wed, 13 Sep 2000, Jerome Raupach wrote: > I want to execute this query on some table2 in the same time : > > INSERT INTO table2_n(f1, f2, f3) > SELECT D

Re: [SQL] left and outer joins?

2000-09-14 Thread Stephan Szabo
If you were looking in just -sql, you'll have missed out on the later information which was on -hackers... I believe Tom Lane just committed changes recently to put in support for them with a few caveats, so unless something comes up, you should see some support in 7.1. On Thu, 14 Sep 2000, M

Re: [SQL] [GENERAL] Foreign Keys Help Delete!

2000-09-20 Thread Stephan Szabo
On Wed, 20 Sep 2000, Josh Berkus wrote: > Timothy, Tom: > > > >1. a. Create new record with new key value in hosts table with the > > >desired value > > > b. Update the routes record to reference the new value > > > c. Delete the old record in the hosts table > > > > > > > Yes, that's what

Re: [SQL] sql query not using indexes

2000-09-20 Thread Stephan Szabo
On Wed, 20 Sep 2000, User Lenzi wrote: > if I start a query: > > explain select * from teste where login = 'xxx' > results: > Index Scan using teste1 on teste (cost=0.00..97.88 rows=25 ) > > > however a query: > explain select * from teste where login > 'AAA' > results: > Seq Scan on teste .

Re: [SQL] How do I run a search on array

2000-09-20 Thread Stephan Szabo
On Thu, 21 Sep 2000, Indraneel Majumdar wrote: > select col1 from table while array_col[1][1:4]='2'; > > how do I do this sort of thing? There seems to be no docs ;-( > > my array is {{"1","2","4","2"},{"3","2","5"},{"6","3","7","9"}} You'll want to check out the array utilities in the contri

Re: [SQL] sql query not using indexes

2000-09-21 Thread Stephan Szabo
On Thu, 21 Sep 2000, Sergio de Almeida Lenzi wrote: > > > On a machine running version 6.5 both queries results index scan. > > > > > > this results that the version 6.5 is faster than version 7.0.2 on this > > > kind of > > > query. > > > > > > > > > Any explanation??? > > > > Have you done

Re: [SQL] Multiple Index's

2000-09-21 Thread Stephan Szabo
On Thu, 21 Sep 2000, Brian C. Doyle wrote: > Hello all, > > How would I prevent a user from submitting information to a table once they > have already done so for that day. I would need them to be able > information on future dates as well as have information in the table from > past dates

Re: [SQL] sql query not using indexes

2000-09-22 Thread Stephan Szabo
On Fri, 22 Sep 2000, Tom Lane wrote: > indexscans; the current code may have overcorrected a shade, but I think > it's closer to reality than 6.5 was. > > As Hiroshi already commented, the difference in results suggests that > the desired data is very nonuniformly scattered in the table. 7.0 >

Re: [SQL] select

2000-09-23 Thread Stephan Szabo
I'd assume this would work: select * from table where booleanfield is null; Stephan Szabo [EMAIL PROTECTED] On Sat, 23 Sep 2000, Jeff MacDonald wrote: > how would i select all rows where a boolean value is neither > t nor f.. ? > > ie if someone inserted without setting the boolean tag.

Re: [SQL] Select between two databases

2000-09-24 Thread Stephan Szabo
On Sun, 24 Sep 2000, Indraneel Majumdar wrote: > Does any one know how I may select between two databases running on same > machine or on different machines eg. > > select colA1 from tableA1 where colA2 in (select colB1 from tableB1); > > here tableA1 and tableB1 are in different databases. The

Re: [SQL] [GENERAL] Foreign Keys Help Delete!

2000-09-19 Thread Stephan Szabo
On Tue, 19 Sep 2000, Timothy Covell wrote: > Schema: > hosts table with fqhn column > routes table with fqhn foreign key hosts(fqhn) > > Problem: > > 1. When I try to change fqhn in hosts, it complains that > I have now violated entry in "routes" table. > > 2. When I try to update "rou

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

2000-10-09 Thread Stephan Szabo
On Mon, 2 Oct 2000, Rini Dutta wrote: > When two tables (table2 and table3) have foreign keys > referring to a common table(table1), I am unable to > have 2 concurrent transactions - one performing insert > on table1 and the other on table2, when the records > being inserted have the same foreign

Re: [SQL] SQL to retrieve foreign keys

2000-10-11 Thread Stephan Szabo
the arguments in a bytea separated by \000 The arguments are as follows: constraint name fk table pk table match type fk col1 pk col1 ... fk coln pk coln Stephan Szabo [EMAIL PROTECTED] On Wed, 11 Oct 2000, Colleen Williams wrote: > Hi, > > I would like to write some SQL to e

Re: [SQL] Referential integrity: broken rule?

2000-10-11 Thread Stephan Szabo
aint later. Stephan Szabo [EMAIL PROTECTED] On Wed, 11 Oct 2000, Franz J Fortuny wrote: > This table: > > create table things > ( > idthing integer not null, > isthis boolean not null > primary key(idthing,isthis) > > > ) > > would be refer

Re: [SQL]

2000-10-23 Thread Stephan Szabo
On Mon, 23 Oct 2000 [EMAIL PROTECTED] wrote: > Hello, > I have following problem with PostgreSQL 6.5.3, I haven't possiblity > to check it on 7.0 and I want to know is it possible to run such query: > > SELECTk.pic, id_g, id_k, count(*) > FROM kart k, pictues p > WHERE k.pic = p.pic > G

Re: [SQL] Add Constraint

2000-10-26 Thread Stephan Szabo
On Wed, 25 Oct 2000, Sivagami . wrote: > Hi all, > > I am a newbie to Postgresql, but I am familiar with SQL. I am trying to add a >constraint to my table using the ALTER TABLE command. The command goes like this : > > ALTER TABLE USER_SIGNUP ADD CONSTRAINT > P_USER_SIGNUP_USER_ID PRIMARY KEY

Re: [SQL] Query Problem

2000-10-26 Thread Stephan Szabo
What is the explain output for the queries you've tried? Stephan Szabo [EMAIL PROTECTED] On Wed, 25 Oct 2000, Josh Berkus wrote: > > Folks: > > Here's the problem, in abstract: I need to select every record in table > A that does not have a link in table B

Re: [SQL] PL/PGSQL beginning is hard....

2000-11-02 Thread Stephan Szabo
> i am a beginner at SQL and PL/pgsql and thus have some surely > already known problems... > > i have set up some tables, and wanted to play around with inbuild > functions, and set up the following function: > > CREATE FUNCTION balance (int4) RETURNS int4 AS ' > DECLARE >compt

[SQL] Re: [GENERAL] Problem with coalesce..

2000-11-01 Thread Stephan Szabo
There are still some contexts in which subqueries in expressions are wierd. The example below appears to work in current sources however. Stephan Szabo [EMAIL PROTECTED] On Tue, 31 Oct 2000, George Henry C. Daswani wrote: > Hello, > > Was wondering if such a call is unsupported,

Re: [SQL] [sql]Joins

2000-11-09 Thread Stephan Szabo
On Fri, 10 Nov 2000, Najm Hashmi wrote: > I am facing a dilemma at my work, I am using postgres first time. For > some reason, my co-workers think that in Postgres joins i.e. > simple joins of two or three tables are so bad that their cost is > exponential. They believe that postgres simply ta

Re: [SQL] how to continue a transaction after an error?

2000-11-13 Thread Stephan Szabo
On Mon, 13 Nov 2000, Cristi Petrescu-Prahova wrote: > Hello, > > I would like to insert a bunch of rows in a table in a transaction. Some of > the insertions will fail due to constraints violation. When this happens, > Postgres automatically ends the transaction and rolls back all the previous >

Re: [SQL] how to continue a transaction after an error?

2000-11-13 Thread Stephan Szabo
> >When you start a transaction, > >you're telling the backend "treat all of these statements as one, big, > >all or nothing event." > > This is actually contrary to the standard. Statements are atomic, and a > failed statement should not abort the TX: > > The execution of all SQL-statemen

Re: [SQL] how to continue a transaction after an error?

2000-11-14 Thread Stephan Szabo
On Tue, 14 Nov 2000, Philip Warner wrote: > >I could > >almost see certain recoverable internal state things being worth not doing > >a rollback for, but not constraints. > > Not true, eg, for FK constraints. The solution may be simple and the > application needs the option to fix it. Also, eg,

Re: [SQL] Using Array-Values in subselect

2000-11-14 Thread Stephan Szabo
If you look in contrib of the source, there is a set of array operators(functions) including element in set. That'll probably do what you want (you don't do an in actually, it'll be like ) On Tue, 14 Nov 2000, Alvar Freude wrote: > Roberto Mello schrieb: > > Looks like you want someth

Re: [SQL] Bug or feature

2000-11-22 Thread Stephan Szabo
What is it actually giving you as an error message in the failing case? Someone pointed out a problem in deferred constraints recently and I think this may be related. Stephan Szabo [EMAIL PROTECTED] On Mon, 20 Nov 2000, Kyle wrote: > Here's an interesting test of referential integri

Re: [SQL] Cache lookup failure

2000-11-29 Thread Stephan Szabo
Do you have any triggers, rules or check constraints defined on the table? If so, you may have fallen pray to the thing that you cannot drop and re-create a function that's used in a trigger without recreating the trigger as well. Stephan Szabo [EMAIL PROTECTED] On Wed, 29 Nov 2000,

Re: [SQL] delete rows

2000-11-29 Thread Stephan Szabo
On Thu, 30 Nov 2000, Astrid Hexsel wrote: > After trying for two weeks to delete more than one row at the time from a form > - checkbox input, I was told that the only way different rows would be inputed > or changed with the information from the form would be with the INSERT command. > > > T

Re: [SQL] I get an error with Foreign Keys

2000-11-30 Thread Stephan Szabo
On Thu, 30 Nov 2000, Brian Powell wrote: > I have around 40 tables defined, many relying on data in others so I have > foreign key constraints. However, whenever I try to delete from any table, > I get: > > ERROR: SPI_execp() failed in RI_FKey_cascade_del() > > What generates this? I need a

Re: [SQL] FOREIGN KEY errors.

2000-12-08 Thread Stephan Szabo
There was a bug (which should be fixed for 7.1) that got the arguments wrong for the alter time check of the existing data. I think I should be able to get a patch together to fix it once I get a copy of the 7.0.3 source. Can you send the table schema as well so I can test it out? Stephan

Re: [SQL] Null comparison

2000-12-13 Thread Stephan Szabo
On Wed, 13 Dec 2000, Al Lewis wrote: > I am migrating to postgress from msql and am encountering numerous problems > in the differences in NULL usage and comparison. > > 1. Why are 2 fields not equal if they are both NULL? Because that's what the SQL spec says. If either value is NULL the resu

Re: [Re: [SQL] postgres]

2000-12-15 Thread Stephan Szabo
On 14 Dec 2000, Marc Daoust wrote: > Thank you very much Reberto, > > It appears that your co-workers are not inerested in potential funding. > For the rude onesmaybe/perhaps people like myself were givin the email > address ever think of that. > > A potential client that is having second t

Re: [SQL] SQL query not working when GROUP BY / HAVING is used

2000-12-19 Thread Stephan Szabo
On Tue, 19 Dec 2000 [EMAIL PROTECTED] wrote: > Hello there > > I have a question regarding a SQL statement. > > When I execute (and that's what I need) > > SELECT Zylinder.Z_durch_soll, Zylinder.Z_id, Zylinder.Z_durch_ist, > ((Zylinder.Z_durch_soll+0.12) - Zylinder.Z_durch_ist) AS durchmesserd

Re: [SQL] substring ..

2000-12-19 Thread Stephan Szabo
On Tue, 19 Dec 2000, Jeff MacDonald wrote: > hi folks.. > > i want to do this to a datetime field.. > > select foo from table where substr(datefoo,1,11) = '2000-12-14'; > > it returns no results yet.. > > select substr(datefoo,1,11) does return some values that say > 2000-12-14 > > any clues

Re: [SQL] how to alter/drop check contraint?

2000-12-20 Thread Stephan Szabo
great deals of pain and suffering, it might be possible to change the 10 to 20 by directly editing the pg_relcheck row. I have not attempted to do this though, so I'm not sure it would work.] Stephan Szabo [EMAIL PROTECTED] On Wed, 20 Dec 2000, hubert depesz lubaczewski wrote: >

Re: [SQL] Create table doesn't work in plpgsql

2000-12-23 Thread Stephan Szabo
I believe (although I haven't tried it) that pltcl will allow you to do things such as this. On Thu, 21 Dec 2000, Volker Paul wrote: > Hi, > > > I don't think you can use DDL(data definition language) in PL/SQL. > > create table is not DML(data munipulation language) instead > > it's a DDL. >

Re: [SQL] Invoice number

2000-12-23 Thread Stephan Szabo
> I'm wondering how people creates guaranteed sequential numbers - in my case > for invoice numbers. > > - Sequences are not rollback'able. > - It seems overkill to have a table just for this. > - What else? You'll probably need a table (although you may be able to get away with only one for a

Re: [SQL] Optimization recommendations request

2000-12-29 Thread Stephan Szabo
What does explain show for your query? On Sat, 23 Dec 2000, Joe Conway wrote: > Hello, > > I'm working on an application where I need to design for one table to grow > to an extremely large size. I'm already planning to partition the data into > multiple tables, and even possibly multiple serv

[ADMIN] Re: [SQL] Removing a constraint?

2001-01-01 Thread Stephan Szabo
It should work if you remove all three triggers for the constraint using drop trigger, don't delete rows from pg_trigger unless you go through and manually change the row in pg_class for the relation the trigger is for. On Mon, 1 Jan 2001, Michael Davis wrote: > Does anyone know how to complete

Re: [SQL] Extracting user db tabel info from system tables???

2001-01-05 Thread Stephan Szabo
On Fri, 5 Jan 2001, Marc Cromme wrote: > I have some problems on making the right joins on system tables to extract > the > structure of some user defined tables/databases. I use PostgreSQL 7.0.2 on > an > RedHat 7.0 box. > > PROBLEM 1: I tried to make a Foreign key constraint from the primar

Re: [SQL] Possible bug? WAS :Bad (null) varchar() externalrepresentation.

2001-01-10 Thread Stephan Szabo
On Thu, 11 Jan 2001, Justin Clift wrote: > I haven't seen a mention of a maximum number of constraints of similar > applying to a table. If so, then could someone please point me to it... > > The reason I mention this is because I've found what seems to be causing > this problem I'm experiencin

Re: [SQL] Using a rule as a trigger.

2001-01-10 Thread Stephan Szabo
As someone else said a serial is probably easier, but a trigger is probably a better bet than a rule for this purpose. Using a plpgsql before insert trigger will do it. On Wed, 10 Jan 2001, Andrew Higgs wrote: > Hi all, > > I have looked at some previous posting and thought that I had found

Re: [SQL] How to display a unixtimestamp from a timestamp record?

2001-01-15 Thread Stephan Szabo
> select user_name, date_part( 'epoch' , timestamp 'acct_timestamp') from > tbacct limit 2; > > it said ERROR: Bad timestamp external representation 'acct_timestamp' > how should i represent date_part( 'epoch' , timestamp 'acct_timestamp') > to work? select user_name, date_part ('epoch', acct

Re: [SQL] deferred constraints failing on commit

2001-01-18 Thread Stephan Szabo
Okay, yep, seems like a garden variety bug to me... What's happening is that the update trigger is checking to make sure that there are no rows referencing the one that was changed, but that's not sufficient for the deferred no action case possibly. It's got to be that there are no rows that no

Re: [SQL] deferred constraints failing on commit

2001-01-18 Thread Stephan Szabo
Can you send the full schema of the tables you are using for this? On Tue, 16 Jan 2001, Michael Richards wrote: > Hi. > > I'm having trouble with committing a transaction. Intuitively it > should work but does not. > > I've got a table with 2 foreign keys, minrev and maxrev. They refer >

Re: [SQL] problem to count (distinct number)

2001-01-18 Thread Stephan Szabo
What version are you using? I believe this was added in 7.0.x, but I could be wrong about that. A query of this sort works on my 7.1beta3 system. On 17 Jan 2001, Mikael Hedin wrote: > I have a table with a column (int4), and I want to know how many > different numbers there are. In an exampl

Re: [SQL] notice on transaction abort?

2001-01-18 Thread Stephan Szabo
On Thu, 18 Jan 2001, Kovacs Zoltan Sandor wrote: > I realized that an error will abort a transaction all the time. > Unfortunately I usually send millions of rows of INSERTs in a transaction > and if there is some error in the middle of the code I got the message > if I try to INSERT a new row:

Re: [SQL] Making a foreign key chain - good idea or bad idea?

2001-01-24 Thread Stephan Szabo
On Wed, 24 Jan 2001, Frank Joerdens wrote: > I just did something which seems to work alright and which makes sense > to me now but which I have a funny feeling about. It may be good > standard practice (and I just don't know about it) or dangerously > foolish or just plain silly: I created a fo

Re: [SQL] Don't want blank data

2001-01-25 Thread Stephan Szabo
On Thu, 25 Jan 2001, David Olbersen wrote: > Greetings, > Is there a way to have postgresql always return a value for each row > requested? To be more clear, if I were using a Perl SQL hybrid I would write > something like > > SELECT computer_ip or 'unset' FROM computers; > > So that

Re: [SQL] SQL Help

2001-01-26 Thread Stephan Szabo
On Fri, 26 Jan 2001, Mark A. Summers wrote: > I am having trouble with the following query taking forever: > - > SELECT * FROM ret108108_00, product > WHERE ret108108_00."isbn" = product."Item1" > > AND product."SuperCategory" = '1' > AND product."PublisherCode" = 'ZON' > ORDER BY ret10

Re: [SQL] how to simulate UPdate ...?

2001-02-05 Thread Stephan Szabo
Isn't this equivalent to? update table1 set na1= (select table2.na1 from table2 where table1.no=table2.no); Which can also be invalid if there can be multiple rows returned by the subselect since there'd be no way to know which table2.na1 you'd want without more info. On Fri, 2 Feb 2001,

Re: [SQL] parse error in create index

2001-02-06 Thread Stephan Szabo
Functional indexes cannot currently take constant values to the function, so it's complaining about the constant 'month'. The current workaround is probably to create a function that does the date_part('month', ) for you and then use that function in the index creation. On Sat, 3 Feb 2001, Hube

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

2001-02-07 Thread Stephan Szabo
Technically you are not allowed to make an FK to non-unique values. What you're closer to looking for is MATCH PARTIAL which we don't support (because it's a real pain - although with the new memory management stuff in 7.1 it may be less of one - since the fundamental problem is storing values f

Re: [SQL] Bug reports for 7.1 beta?

2001-02-07 Thread Stephan Szabo
On Wed, 7 Feb 2001, Josh Berkus wrote: > Folks, > > Where do I send bug reports for 7.1 beta? I;'ve looked on the web > site, and don't see an address or bugtraq forum. Probably the best is the pgsql-bugs mailing list at: [EMAIL PROTECTED]

Re: [SQL] Query never returns ...

2001-02-08 Thread Stephan Szabo
After you load the data, you need to run vacuum analzye. That'll get statistics on the current data in the table. Of course, I'm not sure that'll help in this case. On Thu, 8 Feb 2001, Brice Ruth wrote: > Stephan, > > Here is what EXPLAIN shows: > > NOTICE: QUERY PLAN: > > Sort (cost=0.0

Re: [SQL] Query never returns ...

2001-02-08 Thread Stephan Szabo
What does explain show for the query and have you run vacuum analyze recently on the tables? On Thu, 8 Feb 2001, Brice Ruth wrote: > The following query: > > SELECT > tblSIDEDrugLink.DrugID, > tblSIDEDrugLink.MedCondID, > tblMedCond.PatientName AS MedCondPatientName, >

Re: [SQL] parse error in create index

2001-02-08 Thread Stephan Szabo
You can use two quote characters to get a single quote in the quoted string, so ''month'' On Thu, 8 Feb 2001, Hubert Palme wrote: > Stephan Szabo wrote: > > > > Functional indexes cannot currently take constant values to the function, > > so it'

Re: [SQL] String Concatnation

2001-02-09 Thread Stephan Szabo
I was able to do a function that took two arguments and did that under 7.1beta3 with no trouble. What message are you getting? On Sat, 10 Feb 2001, Najm Hashmi wrote: > Hi, > How can I concatnate two varialbles, seperated by a |, that are type text > together? > v, v1 text; > some work > th

Re: [SQL] Huh? Mysterious Function Error

2001-02-20 Thread Stephan Szabo
Does the function have any SELECTs that aren't SELECT INTOs? On Tue, 20 Feb 2001, Josh Berkus wrote: > Tom, Stephan, Jan, Etc. > > Can you help me with this one? I can't figure out what is meant by > this error message: > > I have a long, complicated PL/pgSQL function called > fn_modif

[GENERAL] Re: [SQL] two tables - foreign keys referring to each other...

2001-02-20 Thread Stephan Szabo
You have to use ALTER TABLE to add the constraint to one of the tables. Deferred refers to the checking of the constraint itself, not really to the check to see if the table is there. On Wed, 21 Feb 2001, Chris Czeyka wrote: > Hey to all, > > I got two tables, linked to each other. How can I t

Re: [SQL] Strange parse error??

2001-02-22 Thread Stephan Szabo
On Thu, 22 Feb 2001, [ISO-8859-1] Bjørn T Johansen wrote: > I am trying to do a simple update (or at least I thought it was > simple), but I just keep getting a parse error, saying: > > Error executing query > > Update "Config" Set "Wave" = 'F:\wav\BTJ.wav',"Answer" = 20, > "Recordwav" ='F:\wav

Re: [SQL] How can i escape a '+' or a '+' in a regexp ?

2001-02-23 Thread Stephan Szabo
I believe you'll need two \ characters to escape the + or *. titulo ~ '\\+' On Fri, 23 Feb 2001, Gabriel Fernandez wrote: > Hi fellows, > > I'm trying to the following query: > > select * from areas where titulo ~ '+' or titulo ~ '*' > > and the answer is: > > ERROR: regcomp failed with e

Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Stephan Szabo
It returns the first five rows it finds. Running the same query over again if there are no updates is safe, but if the table is updated there is the possibility it would find a different five rows. If the query would do a seq scan and you updated a row, the rows would be in a different order in

Re: [SQL] conversion

2001-02-26 Thread Stephan Szabo
It looks like you have some rows for pyear which do not convert cleanly into a number like ' '. What do you want it to do in such cases? On Sun, 25 Feb 2001, Ken Kline wrote: > follow up > actually the destination column is defined > as a numeric(4) > > the following are the statements

Re: [SQL] DLookup('field', 'table', ['condition'])

2001-02-26 Thread Stephan Szabo
On Tue, 27 Feb 2001, Herbert Ambos wrote: > I'm trying to create Domain Aggregate function that mimic Access' Dlookup > function, but without any luck, after digging (i think) all the docs > don't have the solution yet. > > Syntax: > > DLookup ('field', 'table|view', ['condition']) > >

Re: [SQL] Weird NOT IN effect with NULL values

2001-03-01 Thread Stephan Szabo
On Thu, 1 Mar 2001, Frank Joerdens wrote: > When doing a subselect with NOT IN, as in > > SELECT name > FROM customer > WHERE customer_id NOT IN ( > SELECT customer_id > FROM salesorder > ); > > (from Bruce Momjian's book) > > I get no rows if the result column returned by the subselect > con

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

2001-03-02 Thread Stephan Szabo
If you're only doing a simple check for reference, why not use foreign keys? In general however, you probably want to use plpgsql to define the trigger. And trigger functions don't take parameters in the normal sense, the function should be created taking no args and returning opaque; the para

Re: [SQL] random

2001-03-05 Thread Stephan Szabo
On Mon, 5 Mar 2001, Bruce Momjian wrote: > > Jelle Ouwerkerk <[EMAIL PROTECTED]> writes: > > > Also, is there a way to randomize the order of a result set? > > > > There's always > > SELECT * FROM foo ORDER BY random(); > > > > How does that work? > > test=> select random(); >

Re: [SQL] cannot get CREATE TABLE AS to work

2001-03-09 Thread Stephan Szabo
On Fri, 9 Mar 2001, Josh Berkus wrote: > Robert, > > > I suspect that the INSERT INTO SELECT in this case will take longer than a > > CREATE TABLE AS because of the referential integrity check needed on every > > INSERT (per Tom Lane). > > In that case, what about: > > a) dropping the referent

RE: [SQL] cannot get CREATE TABLE AS to work

2001-03-09 Thread Stephan Szabo
On Fri, 9 Mar 2001, Creager, Robert S wrote: > > Well, that explains why I wasn't seeing any appreciable speed increase with > the INITIALLY DEFERRED. I tried mucking in pg_class, and saw a 3 fold > increase in insert speed on inserts into my table with 2 relational > triggers. SET CONSTRAINTS

Re: [SQL] Optimization via explicit JOINs

2001-03-09 Thread Stephan Szabo
On Fri, 9 Mar 2001, David Olbersen wrote: > Greetings, > I've been toying aroudn with postgres 7.1beta5's ability to control the > planner via explicitely JOINing tables. I then (just for giggles) compare the > difference in the EXPLAIN results. > > I'm no super-mondo-DBA or anything, b

Re: [SQL] Optimization via explicit JOINs

2001-03-09 Thread Stephan Szabo
> On Fri, 9 Mar 2001, Stephan Szabo wrote: > > ->Not entirely. Those are only estimates, so they don't entirely line up > ->with reality. Also, I notice the first estimates 14 rows and the second > ->1, which is probably why the estimate is higher. In prac

Re: [SQL] Optimization via explicit JOINs

2001-03-09 Thread Stephan Szabo
On Fri, 9 Mar 2001, David Olbersen wrote: > On Fri, 9 Mar 2001, Stephan Szabo wrote: > > -> Hmm, what were the two queries anyway? > > The "slower" query > > SELECT > to_char( p.insertion_time, 'HH:MI AM MM/DD' )

Re: [SQL] Optimization via explicit JOINs

2001-03-09 Thread Stephan Szabo
Darn. Well, one of the queries picked that 1 row was going to survive the nested loop step and the other said 14. I was wondering which one was closer to being correct at that time. On Fri, 9 Mar 2001, David Olbersen wrote: > On Fri, 9 Mar 2001, Stephan Szabo wrote: > > ->As a q

Re: [SQL] Optimization via explicit JOINs

2001-03-09 Thread Stephan Szabo
Actually, just thought of something else. If you remove the probably redundant p.song_id=s.song_id from the second query (since the join ... using should do that) does it change the explain output? On Fri, 9 Mar 2001, David Olbersen wrote: > On Fri, 9 Mar 2001, Stephan Szabo wrote: >

Re: [SQL] help

2001-03-12 Thread Stephan Szabo
What is the schema of the table in question, does it have any references to other tables and what is an example insert statement? On Wed, 7 Mar 2001, chard wrote: > > help me pls. > i got an error like this when i do an insert to a table, my table dont > have bpchar type of field. > > ERROR:

Re: [SQL] How does this query work.....?

2001-03-12 Thread Stephan Szabo
pg_class holds the relation information (tables, etc) pg_attribute holds attribute information (attname), it keeps the oid of the relation it's on in attrelid and the oid of the type as atttypid pg_type holds type information (typname) The attnum>0 is to limit the check to user attributes.

Re: [SQL] VACUUM kills Index Scans ?!

2001-03-15 Thread Stephan Szabo
On Thu, 15 Mar 2001, Gerald Gutierrez wrote: > 1) When I create a empty table, and then immediate create an index on a > column, I can get /index scans/ when searching on that column. But when I > then run VACUUM, the same search becomes a /sequential scan/. Shouldn't it > still be an index s

  1   2   3   4   5   6   7   8   >