[SQL] Correlated Update Query

2013-06-02 Thread Robert DiFalco
I have an update query that I'm not sure if I am taking a good approach or a naive one. It works but seems ugly. I have a table named "contacts". Contacts have a user_id and an owner_id. There is also a one to many relationship between contacts and email addresses. Users also have an email addres

Re: [SQL] [noob] How to optimize this double pivot query?

2012-10-03 Thread Robert Buck
can also run this in a defined transaction boundary rather than using auto-commit. Right now I am thumbing through your email and trying it out. Bob On Wed, Oct 3, 2012 at 12:23 PM, Robert Buck wrote: > Thank you, Samuel. > > I am trying some of this out right now... > > This is gr

Re: [SQL] [noob] How to optimize this double pivot query?

2012-10-03 Thread Robert Buck
from > multiple tables into the same row. > > > > On Tue, Oct 2, 2012 at 12:57 PM, Samuel Gendler > wrote: > >> >> >> On Tue, Oct 2, 2012 at 2:45 AM, Robert Buck wrote: >> >>> Hi Samuel >>> >>> Thank you. This may be a bit

Re: [SQL] [noob] How to optimize this double pivot query?

2012-10-02 Thread Robert Buck
Hi Samuel Thank you. This may be a bit of a stretch for you, but would it be possible for me to peek at a sanitized version of your cross tab query, for a good example on how to do this for this noob? This will be pretty common in my case. The biggest tables will get much larger as they are r

Re: [SQL] [noob] How to optimize this double pivot query?

2012-10-01 Thread Robert Buck
sql-ow...@postgresql.org] *On Behalf Of *Robert Buck > *Sent:* Monday, October 01, 2012 8:47 PM > *To:* pgsql-sql@postgresql.org > *Subject:* [SQL] [noob] How to optimize this double pivot query? > > ** ** > > I have two tables that contain key-value data that I want to combine in &

[SQL] [noob] How to optimize this double pivot query?

2012-10-01 Thread Robert Buck
I have two tables that contain key-value data that I want to combine in pivoted form into a single result set. They are related to two separate tables. The tables are: test_results, test_variables, metric_def, metadata_key. The latter two tables are enum-like tables, basic descriptors of data stor

Re: [SQL] Insane behaviour in 8.3.3

2012-06-15 Thread Robert Edwards
On 14/06/12 18:39, Achilleas Mantzios wrote: dynacom=# SELECT id from items_tmp WHERE id=1261319 AND xid=currval('xadmin_xid_seq'); id (0 rows) dynacom=# -- THIS IS INSANE Have you tried: SELECT id from items_tmp WHERE id=1261319 AND xid=currval('xadmin_xid_seq'::text) or even: SE

Re: [SQL] [seapug] Re: [BUGS] pg_dump: aborting because of server version mismatchT

2012-05-03 Thread Robert Bernier
nd it wouldn't generate any errors although I wouldn't want to test it out on important stuff. Robert Bernier On Wednesday, May 02, 2012 02:53:53 pm Kevin Grittner wrote: > Mitesh Shah wrote: > > *pg_dump: server version: 9.1.2; pg_dump version: 9.0.5* > > *pg_dump: abor

Re: [SQL] Performance of NOT IN and <> with PG 9.0.4

2011-05-27 Thread Robert Haas
he EXPLAIN ANALYZE output and try to figure out which part of the plan is being mis-estimated. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Performance of NOT IN and <> with PG 9.0.4

2011-05-25 Thread Robert Haas
e's only one materialize node in the whole plan. And just incidentally, do you have any of the other enable_* settings turned off? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To ma

Re: [SQL] Performance of NOT IN and <> with PG 9.0.4

2011-05-25 Thread Robert Haas
On Tue, May 24, 2011 at 7:45 AM, Jasmin Dizdarevic wrote: > Hi, > found the problem. > 238 sec. with set enable_material = 'on' > 4(!) sec. with set enable_material = 'off' > > @Robert Haas: I thought it would be interesting to you, because > you've c

Re: [SQL] Dollar quoted strings

2010-03-25 Thread Robert Manning
Hi John, The type code 2003 indicates an SQL99 column type of ARRAY, which is not currently supported for rendering/editing. Here is the feature request for SQuirreL SQL Client to track this feature: https://sourceforge.net/tracker/?func=detail&aid=2972937&group_id=28383&atid=393417 Rob On Wed

Re: [SQL] ERROR: null value in column "id" violates not-null constraint

2009-10-11 Thread Robert Paulsen
On Sunday 11 October 2009 8:22 am, Dmitriy Igrishin wrote: > Hello! > > Please, read pg_dump(1) manual page. You will find this text in it: > "It is not guaranteed that pg_dump's output can be loaded into a server of > an older major version -- not even if the dump was taken from a server > of t

Re: [SQL] ERROR: null value in column "id" violates not-null constraint

2009-10-11 Thread Robert Paulsen
On Sunday 11 October 2009 3:32 am, Dmitriy Igrishin wrote: > Hello. > Note, that you may use SERIAL data type and PostgreSQL will implicitly > create sequence for you column, for example, > CREATE table test ( > id SERIAL NOT NULL PRIMARY KEY, -- PostgreSQL will implicitly > create 'tes

Re: [SQL] ERROR: null value in column "id" violates not-null constraint

2009-10-10 Thread Robert Paulsen
On Saturday 10 October 2009 4:12 pm, Tom Lane wrote: > Robert Paulsen writes: > > I do have a question, though, I fixed things as indicated above: > > id integer DEFAULT nextval('vault_id_seq') NOT NULL, > > Dump gave back > > id integer DEFAULT n

Re: [SQL] ERROR: null value in column "id" violates not-null constraint

2009-10-10 Thread Robert Paulsen
On Saturday 10 October 2009 3:16 pm, Tom Lane wrote: > Robert Paulsen writes: > > On Saturday 10 October 2009 2:00 pm, Robert Paulsen wrote: > >> So no default for id. What should it be? > >> default nextval('vault_id_seq') > > > > Should have tr

Re: [SQL] ERROR: null value in column "id" violates not-null constraint

2009-10-10 Thread Robert Paulsen
On Saturday 10 October 2009 2:00 pm, Robert Paulsen wrote: > > So no default for id. What should it be? > > Something like one of this? > > default nextval('vault_id_seq') > Should have tried that before posting last message -- it worked. Thanks! -- Sent vi

Re: [SQL] ERROR: null value in column "id" violates not-null constraint

2009-10-10 Thread Robert Paulsen
On Saturday 10 October 2009 1:46 pm, Tom Lane wrote: > Robert Paulsen writes: > > I have a database with a sequence field as a primary key in a table and > > can no longer insert data into it as it gets the subject error message. > > Does the table actually have a default

[SQL] ERROR: null value in column "id" violates not-null constraint

2009-10-10 Thread Robert Paulsen
varying(256) NOT NULL, passwd character varying(256) NOT NULL, url character varying(4096), notes text ); CREATE SEQUENCE vault_id_seq INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1; ALTER TABLE public.vault_id_seq OWNER TO robert; SELECT pg_catalog.setval('vault

Re: [SQL] uniqueness constraint with NULLs

2009-06-29 Thread Robert Edwards
Thanks for all these great ideas! Craig Ringer wrote: On Mon, 2009-06-29 at 15:42 +1000, Robert Edwards wrote: Can anyone suggest a way that I can impose uniqueness on a and b when c is NULL? One way is to add an additional partial index on (a,b): CREATE INDEX bobtest_ab_unique ON bobtest

Re: [SQL] uniqueness constraint with NULLs

2009-06-29 Thread Robert Edwards
A. Kretschmer wrote: In response to Robert Edwards : Can anyone suggest a way that I can impose uniqueness on a and b when c is NULL? Sure, use a functional index: test=# create table bobtest (a int, b int, c int); CREATE TABLE test=*# create unique index idx_bobtest on bobtest(a,b,coalesce

[SQL] uniqueness constraint with NULLs

2009-06-28 Thread Robert Edwards
I have a table with a uniqueness constraint on three columns: # \d bobtest Table "public.bobtest" Column | Type | Modifiers +-+-- id | integer | not null default nextval('bob

Re: [SQL] Problem with pg_connect() in PHP

2008-09-25 Thread Robert Edwards
Looks like you are missing the php_pgsql extension (I assume you are running on a Windows server). On Debian GNU/Linux, it is called php5-pgsql (or php4-pgsql, as appropriate). Not sure what it would be called for Windows, but something similar. Simply enabling it (by uncommenting the line in yo

Re: [SQL] May I have an assistance on CREATE TABLE Command

2008-09-17 Thread Robert Edwards
You could: INSERT INTO REGION VALUES (33, 'New Dar'); UPDATE DISTRICT SET region_id = 33 WHERE region_id = 99; DELETE FROM REGION WHERE region_id = 99; UPDATE REGION SET region_name = 'Dar es Salaam' WHERE region_id = 33; Of course, if there is no uniqueness constraint on region_name then yo

Re: [SQL] Proposed archival read only trigger on rows - prevent history modification

2008-02-21 Thread Robert Treat
ves (on update do nothing) which tends to work pretty well. You can also add triggers into the mix to raise errors on update. Also dont forget to revoke update/delete/install privileges as appropriate. And look into vacuum freeze. -- Robert Treat Build A Brighter LAMP :: Linu

Re: [SQL] accounting schema

2008-02-06 Thread Robert Edwards
Medi Montaseri wrote: Hi, I am learning my way into Accounting and was wondering how Accounting applications are designed. perhaps you could point the way On one hand, accountants talk about a sacret equation A = L + OE (Asset = Libility + Owner Equity) and then under each categories the

Re: [SQL] query to select a linked list

2007-05-09 Thread Robert Edwards
Hi Louis-David, I also have written a forum application using PostgreSQL. My schema has a "threadid" for each posting, which is actually also the "messageid" of the first posting in the thread, but that is irrelevant. I can then just select all messages belonging to that thread. The actual hie

Re: [SQL] Insert into a date field

2007-02-05 Thread Hiltibidal, Robert
Try this: '1/9/1963' I'm interpreting your date to be January 9, 1963. -R From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ezequias Rodrigues da Rocha Sent: Friday, February 02, 2007 7:08 AM To: pgsql-sql@postgresql.org Subject: [SQL] I

Re: [SQL] Index Anding

2007-02-05 Thread Hiltibidal, Robert
I will investigate this. Our gcc is only able to compile 32 bit. I think I will have to see if I can get/compile a 64 bit gcc I appreciate the help! -R -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Browne Sent: Thursday, February 01, 2007 4:45

[SQL] Compilation Error AIX

2007-02-05 Thread Hiltibidal, Robert
I am getting this error make -C port all make[3]: Entering directory `/db2/logs/downloads/postgres/postgresql-8.2.1/src/backend/port' gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -I../../../src/include -c

[SQL] Compilation errors

2007-02-05 Thread Hiltibidal, Robert
Is this a good group to post compilation errors to? PRIVILEGED AND CONFIDENTIAL This email transmission contains privileged and confidential information intended only for the use of the individual or entity named above. If the reader of the email is not the intended recipient or the employee

Re: [SQL] Index Anding

2007-02-05 Thread Hiltibidal, Robert
This is excellent information Thank you! -Original Message- From: Andrew Sullivan [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 31, 2007 9:53 AM To: Hiltibidal, Robert; pgsql-sql@postgresql.org Subject: Re: Index Anding You probably want to take these questions to the -general

[SQL] Index Anding

2007-02-05 Thread Hiltibidal, Robert
Good Morning I am considering postgres for a project I am currently using DB2 for. The database is a 200 gb database on db2. The os is AIX 5.2 on a p5 series box with 2 processors and 7 gb ram. I have 300 gb in local scsi mirrored and 300 gb of shark disk raid5. The database

[SQL] Index ANDing & Index ORing

2007-02-05 Thread Hiltibidal, Robert
Does postgres have support for index ANDing and index ORing? Thanks! -Rob PRIVILEGED AND CONFIDENTIAL This email transmission contains privileged and confidential information intended only for the use of the individual or entity named above. If the reader of the email is not the int

Re: [SQL] [GENERAL] Any documatation about porting from Oracle to PostgreSQL

2006-10-18 Thread Robert Treat
) Felix, in case your still watching, a (in theory) more up to date link would be found at http://www.postgresql.org/docs/techdocs.3. Oh, and please don't crosspost across 3 different lists in the future, it just creates noise for the rest of us. -- Robert Treat Build A Brighter LAMP ::

Re: [SQL] hi i am gettin error when i am deleting a function from

2006-09-11 Thread Robert Edwards
Can you give us the actual delete command you are issuing? You need to specify the types of the function arguments when deleting functions, for example: DELETE FUNCTION my_sum (int, int); etc. Cheers, Bob Edwards. Penchalaiah P. wrote: Hi good morning to all…. I created some functions in

Re: [SQL] on connect/on disconnect

2006-09-11 Thread Robert Edwards
Markus Schaber wrote: Hi, Robert, Robert Edwards wrote: (this is my first post to this list...) Welcome here. :-) I am wondering if Postgres, and/or SQL in general, has a facility to run a function at connection set-up time (after a successful connection attempt) and/or at session

Re: [SQL] on connect/on disconnect

2006-09-10 Thread Robert Edwards
rotocol is that this is not allowed. Anyway, I still need to know if running functions during connection setup and tear-down, or change of user, is possible or not. Cheers, Bob Edwards. Aaron Bono wrote: On 9/10/06, *Robert Edwards* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> w

[SQL] on connect/on disconnect

2006-09-10 Thread Robert Edwards
(this is my first post to this list...) I am wondering if Postgres, and/or SQL in general, has a facility to run a function at connection set-up time (after a successful connection attempt) and/or at session completion (or disconnect)? I want to pre-populate a table (actually an INSERT rule on a

Re: [SQL] Function Parameters in GROUP BY clause cause errors

2006-03-23 Thread Davidson, Robert
intimidated by figuring out what to download to try compiling source. Best Regards, Robert Davidson -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 22, 2006 8:27 PM To: Davidson, Robert Cc: pgsql-sql@postgresql.org; pgsql-bugs@postgresql.org Subject

[SQL] Function Parameters in GROUP BY clause cause errors

2006-03-22 Thread Davidson, Robert
Title: Function Parameters in GROUP BY clause cause errors When I use a parameter in a query which aggregates it fails with a GROUP BY error. What syntax can I use to avoid this error? CREATE TABLE test (email_creation_datetime timestamp); INSERT INTO test VALUES ('2006-03-20 09:00'); INSE

Re: [SQL] Using a parameter in Interval

2006-03-22 Thread Davidson, Robert
the outlook-ism, -Owen -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Davidson, Robert Sent: Tuesday, March 21, 2006 4:53 PM To: pgsql-sql@postgresql.org Subject: [SQL] Using a parameter in Interval No matter how I try to concatenate, I can't seem to get

[SQL] Using a parameter in Interval

2006-03-21 Thread Davidson, Robert
;testing" near line 2 I have tried concatenating it as a declared variable (with and without apostrophes) 1 weeks And ‘1 weeks’ With no success. Any tips? Many thanks, Robert

[SQL] plpqsql and RETURN NEXT requires a LOOP?

2006-03-21 Thread Davidson, Robert
result set. Is this correct? If so, I would be happy to post this example to the interactive docs (which could use a RETURN NEXT example), but wanted to make sure that I wasn’t missing something more elegant or more efficient. Best Regards, Robert Davidson

Re: [SQL] in PlPgSQL function, how to use variable in a "select ...

2006-03-17 Thread Robert Treat
guage 'plpgsql' IMMUTABLE STRICT; > select test('001'); > This function would work on 8.1, provided you created the sql statement correctly: query_value := 'SELECT col2 FROM ' ||lengendTableName||' WHERE col1 = \'' || col1_value || '\'';

[SQL] removing "not null" modifier

2006-03-13 Thread Robert Urban
ll Primary key: event_pkey Triggers: RI_ConstraintTrigger_43210 The question: how can I get rid of the "not null" modifier on status_id? thanks, Robert Urban ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Question re: relational technique

2006-03-13 Thread Robert Paulsen
On Monday 13 March 2006 03:03, Richard Huxton wrote: > Robert Paulsen wrote: > > This still requires me to modify the overall database structure but not > > the original item table. As my reward :) I get to use any type I choose > > for each new attribute. > > The

Re: [SQL] Question re: relational technique

2006-03-12 Thread Robert Paulsen
On Sunday 12 March 2006 11:29, chester c young wrote: > --- Robert Paulsen <[EMAIL PROTECTED]> wrote: > > One problem with the above is that the list of attributes is fixed. I > > am looking for a way to assign new, previously undefined, attributes > > to > > &

[SQL] Question re: relational technique

2006-03-12 Thread Robert Paulsen
Here is a sample table: item item_id int namechar attrib1 char attrib2 char attrib3 char One problem with the above is that the list of attributes is fixed. I am looking for a way to assign new, previously undefined, attributes to items without changing the table structure

Re: [SQL] Getting yyyy-mm-dd 00:00:00 in an arbitrary time zone

2006-03-03 Thread Davidson, Robert
It does, doesn't it. And it does it just the way it is documented in 9.9.3 AT TIME ZONE table 9.27. I was expecting it to be harder and didn't see I had figured out the right answer already - thanks! Robert -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Se

[SQL] Getting yyyy-mm-dd 00:00:00 in an arbitrary time zone

2006-03-03 Thread Davidson, Robert
amp(extract(YEAR from '2005-12-31 23:00:00-800' at time zone 'CST')||'-'||     extract(MONTH from '2005-12-31 23:00:00-800' at time zone 'CST')||'-'||     extract(DAY from '2005-12-31 23:00:00-800' at time zone 'CST')||' 00:00

[SQL] Why can't I use daylight savings time aware time zones with the AT TIME ZONE clause?

2006-03-02 Thread Davidson, Robert
pc-linux-gnu, compiled by GCC 2.95.3 Why can't I use daylight savings time aware time zones with the AT TIME ZONE clause? Many thanks, Robert Davidson

Re: [SQL] Extract week from date, start with sunday

2005-11-07 Thread Robert Blixt
> -Ursprungligt meddelande- > Från: Janning Vygen [mailto:[EMAIL PROTECTED] > Skickat: den 7 november 2005 15:18 > Till: pgsql-sql@postgresql.org > Kopia: Robert Blixt > Ämne: Re: [SQL] Extract week from date, start with sunday > > Am Montag, 7. November 2005 14

[SQL] Extract week from date, start with sunday

2005-11-07 Thread Robert Blixt
correct week. Is there a workaround for this? Thanks! Kind Regards, Robert ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

[SQL] Function with dynamic command (EXECUTE) not working

2005-11-02 Thread Robert Blixt
) ) LOOP END LOOP; RETURN NEXT rRec; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE; [/CODE] Any help is highly appreciated. Kind Regards, Robert ---(end of broadcast)--- TIP 6: explain analyze is your friend

[SQL] Table Constraint CHECK(SELECT()) alternative?

2005-09-05 Thread Robert D. Kennedy
Hello, I have seen in another thread that sub-queries in a CHECK constraint have implementation ramifications that make them awkward to implement and support. OK, fair enough, c'est la vie. ERROR: cannot use subquery in check constraint is the result. I have a model which seems to BE

Re: [SQL] Are long term never commited SELECT statements are a pr

2005-07-22 Thread KÖPFERL Robert
You may get problems. At least we did. Having a long term transaction which seemingly just was one Begin with nothing, we encountered a siginifficant decrease of performance after some days (70 tx/sec) During that the pg_subtrans dir filled up with files and the IO-reads of the disk as well. After

Re: [SQL] Help on Procedure running external function

2005-07-04 Thread KÖPFERL Robert
Maybe you're looking for the VOLATILE attribute of a function. For the query optimizer it depends on what type of function you have how often it is called. |-Original Message- |From: Din Adrian [mailto:[EMAIL PROTECTED] |Sent: Dienstag, 05. Juli 2005 01:10 |To: Zac; pgsql-sql@postgresql.o

[SQL] UNIT-tests and SQL

2005-07-01 Thread KÖPFERL Robert
What's your experience concerning unit tests for stored procedures on postgres? I'd expect to write wrappers for any *unit - programming language and use its *unit variant to do the actual testing. >From my feeling SQLunit is kind of too xml-ish and I'm not sure wheter I can save the output of som

Re: [SQL] ENUM like data type

2005-06-30 Thread KÖPFERL Robert
|> > I disagree. In several relations (views of the world) one |needs to have a |> > hand full of well defined values while |> > integers or bools are not appropriate and strings are too |free form. |> > For example male female or true and false. Whilst the |second has a well |> > known type, ot

[SQL] Insert rule and default values for PK

2005-06-29 Thread KÖPFERL Robert
Hi, I've a prolem inserting records in a view using different ways. I want to insert either way, with PK given and without PK which should then be taken by its DEFAULT stanza: insert into a_and_b(a) values (537)# id not given, self assigned insert into a_and_b(x) values (true)# id not give

Re: [SQL] ENUM like data type

2005-06-29 Thread KÖPFERL Robert
| |I personally think that the ENUM data type is for databases |that are not well |designed. So, if you see the need for ENUM, that means you |need to re-think |your data design. | I disagree. In several relations (views of the world) one needs to have a hand full of well defined values while

[SQL] Converting TBL->View complaining about indexes

2005-06-24 Thread KÖPFERL Robert
Hi, I'm currently trying to make a table (where many fcns depend on) become a view. Thus I did a _truncate_ and lots of _alter table drop constraint_ and _drop index_ and then CREATE OR REPLACE RULE "_RETURN" AS ON SELECT TO "smsMessagesrewtet" DO INSTEAD SELECT "MessageID",. Post

Re: [SQL] Alias to a type

2005-06-22 Thread KÖPFERL Robert
Keep in mind, though. Using a DOMAIN in some definition 'seals' the domain. Yo can't change the domain unless you drop all dependent objects |-Original Message- |From: Veikko Mäkinen [mailto:[EMAIL PROTECTED] |Sent: Mittwoch, 22. Juni 2005 15:14 |To: pgsql-sql@postgresql.org |Subject: Re:

[SQL] Converting varchar to bool

2005-06-15 Thread KÖPFERL Robert
Hi, I have currently trouble working with boolean values and variables in functions. As one would expect, a select '1'::bool, 't'::bool, 'true'::unknown::boolean works. As a select '1' tells us this seems as a conversion unknown->bool or ??maybe?? a boolean literal?? what-o-ever, at least my

[SQL] How-to suggestions to views

2005-06-10 Thread KÖPFERL Robert
Hi, in the course of my investigation on how to agglomerate or concat several tables using a view or functions the following little HOW-TO felt out. It is kind of a full fledged example of how to coalesce two tables using a view. However it is as it is and I am more less new to writing rules and t

Re: [SQL] Cursor need it?

2005-06-08 Thread KÖPFERL Robert
| |I am a new postgres user | |I want to get a list of tables from pg_tables where tables are like |‘%wo%’ (for example).. and then query that list …. | |Select count(*) from tableVARIABLENAMEFROMFIRSTQUERY | |In SQL SERVER I can do that using cursor but in postgresql I don’t |understand how to

[SQL] Experience with splitting a Table transparently

2005-06-08 Thread KÖPFERL Robert
Hi, I'm looking for people who have got experience at splitting a table with heavy records into two relations. In my case there exists one table with the mentioned heavy records. These are processed by a statemachine. Thus a bunch of columns gets changed several times in the livetime of one recor

[SQL] Can we stop that?

2005-06-07 Thread KÖPFERL Robert
Can please some of the administrators remove that member or what-o-else -Original Message-From: AntiSpam UOL [mailto:[EMAIL PROTECTED]Sent: Dienstag, 07. Juni 2005 11:22To: KÖPFERL RobertSubject: RE: Re: [SQL] SQL equivalent to nested loop ANTISPAM UOL »

Re: [SQL] SQL equivalent to nested loop

2005-06-07 Thread KÖPFERL Robert
; |-Original Message- |From: Markus Bertheau [mailto:[EMAIL PROTECTED] |Sent: Dienstag, 07. Juni 2005 01:17 |To: KÖPFERL Robert |Cc: pgsql-sql@postgresql.org |Subject: RE: [SQL] SQL equivalent to nested loop | | |Dnia 06-06-2005, pon o godzinie 20:08 +0200, KÖPFERL Robert napisał(a): |&

Re: [SQL] SQL equivalent to nested loop

2005-06-06 Thread KÖPFERL Robert
This is basicly a Join, a cross table i.e. select b.w from table a, table b where ... |-Original Message- |From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] |Sent: Montag, 06. Juni 2005 18:53 |To: pgsql-sql@postgresql.org |Subject: [SQL] SQL equivalent to nested loop | | |Hi, | |I bas

Re: [SQL] Returning a Cross Tab record set from a function

2005-06-06 Thread KÖPFERL Robert
|-Original Message- |From: Marc Wrubleski [mailto:[EMAIL PROTECTED] |Sent: Mittwoch, 01. Juni 2005 16:15 |To: pgsql-sql@postgresql.org |Subject: [SQL] Returning a Cross Tab record set from a function | [...] | |It seems I can do this from any higher level language, but it drives me |crazy

Re: [SQL] How do write a query...

2005-06-06 Thread KÖPFERL Robert
You could have a look at the OFFSET and LIMIT modifiers as for untested example select ((select max( "AValue") from table group by "Num") - "AValue") as difference from table order by "AValue" desc offset 1 this says: give me a inversed ordered AValue-list but ommitting the first (biggest) and su

Re: [SQL] getting details about integrity constraint violation

2005-06-03 Thread KÖPFERL Robert
| |You can't, at the moment, except by parsing the text message. | |The "error fields" facility in the FE/BE protocol could be extended |in that direction, and I think there's already been some discussion |about it; but no one has stepped up with a concrete proposal, much |less volunteered to do t

[SQL] Splitting a table for performance reasons

2005-06-02 Thread KÖPFERL Robert
Hi, I've got a table whose records are more less big. There's however jus one Int-column changed frequently. According to postgres' MVCC a whole record gets written, even if just one bit was changed. I think of splitting the table now in two parts, connected via the former PK. so like: a|b|data |

Re: [SQL] [GENERAL] index row size 2728 exceeds btree maximum, 27

2005-06-02 Thread KÖPFERL Robert
To me it seems that the definer of this table missed the concept index ... or the concept database One usually looks up data using a key, but if the whole row is the key, what data shall be looked up. So short story long: Remove data from your index. The data column seems like the data to be look

Re: [SQL] Generic Join on Arrays

2005-05-30 Thread KÖPFERL Robert
Thanks. Since I was just interested in this special case (while the general wasn't interesting, either) this helped me. Also psql -E is a nice new feature to me. |-Original Message- |From: Michael Fuhr [mailto:[EMAIL PROTECTED] |Sent: Montag, 30. Mai 2005 16:09 |To: KÖPFERL Rober

[SQL] Generic Join on Arrays

2005-05-30 Thread KÖPFERL Robert
Hi, I'm currently on retrieving meta infromation about db-schemas. As I found out, pg_proc relation provides me with data about defined stored procedures. Togehter with other relations as pg_type I can retrieve readable information, like: select proname, pd.description FROM pg_proc pp left outer

Re: [SQL] Need clarification

2005-05-23 Thread KÖPFERL Robert
Your're looking for the interval data type. timestamp - timestamp or date - date can be compared with interval CURRENT_TIMESTAMP - '4d'::interval => today - 4 days |-Original Message- |From: [EMAIL PROTECTED] |[mailto:[EMAIL PROTECTED] |Sent: Montag, 23. Mai 2005 11:52 |To: pgsql-sql@p

Re: [SQL] Calling Functions in RULEs

2005-05-23 Thread KÖPFERL Robert
Hi, I had no try wheter this solves your problem, but have you conciddered using an array or a self-written fcn which dicards your results i.E. SELECT my_discard_but_last( q1(), q2(), q3()); or SELECT ARRAY[ q1(), q2(), q3() ]; or SELECT ROW(q1(), q2(), q3()) as my_tripel_type; Have you consi

Re: [SQL] postgre variable

2005-05-19 Thread KÖPFERL Robert
You should considder a variation as Volkan suggested. Otherwise the EXECUTE command might be what you are looking for. Execute a sql made up in a string |-Original Message- |From: bandeng [mailto:[EMAIL PROTECTED] |Sent: Donnerstag, 19. Mai 2005 04:11 |To: pgsql-sql@postgresql.org |Subjec

Re: [SQL] Meaning of ERROR: tuple concurrently updated

2005-05-19 Thread KÖPFERL Robert
|PFERL_Robert?= <[EMAIL PROTECTED]> writes: |> Thus I run VACUUM ANALYZE; every night by cron. However I |keep getting |> ERROR: tuple concurrently updated | |Have you got other processes also doing VACUUM ANALYZE? The only known |reason for this to happen is that two processes concurrently |A

[SQL] Meaning of ERROR: tuple concurrently updated

2005-05-18 Thread KÖPFERL Robert
Hi, I have got some kind of FIFO-queue table. New records are inserted and the oldest are DELETEd. Thus I run VACUUM ANALYZE; every night by cron. However I keep getting ERROR: tuple concurrently updated My research lead me to the point that this is VACUUM tothether with the INSERTs being issued

Re: [SQL] How do I connect with something like JDBCManager to Pos

2005-04-22 Thread KÖPFERL Robert
You are most probably missing entries in pg_hba.conf and the listen= directive in postgres.conf |-Original Message- |From: Adriaan Botha [mailto:[EMAIL PROTECTED] |Sent: Freitag, 22. April 2005 11:23 |To: 'PostgreSQL' |Subject: [SQL] How do I connect with something like JDBCManager to |Po

Re: [SQL] Function to either return one or all records

2005-04-20 Thread KÖPFERL Robert
ROTECTED] |Sent: Mittwoch, 20. April 2005 23:06 |To: Tambet Matiisen |Cc: KÖPFERL Robert; pgsql-sql@postgresql.org |Subject: Re: [SQL] Function to either return one or all records | | |"Tambet Matiisen" <[EMAIL PROTECTED]> writes: |> Standard technique is to rewrite OR que

[SQL] Function to either return one or all records

2005-04-20 Thread KÖPFERL Robert
Hi all, I think I have got a usual problem. I'm asking here, however, because I wonder why it works this way. The problem is to write a fcn that eihter returns all records or just one/none filtered by some expression. For example get a value by id or return all values if the given id is null. F

Re: [SQL] trying to do an update a bit confused.

2005-04-19 Thread KÖPFERL Robert
You're most probably missing a Where clause after the parentensis. see: -Original Message-From: Joel Fradkin [mailto:[EMAIL PROTECTED]Sent: Dienstag, 19. April 2005 16:06To: pgsql-sql@postgresql.orgSubject: [SQL] trying to do an update a bit confused. update tblcase  s

Re: [SQL] Query about SQL in PostgreSQL

2005-04-19 Thread KÖPFERL Robert
Postgres has the weird behavour to compare identifies case sensitive BUT to downcast any non-quoted identifier inside an SQL statement. So it is reccomended to just use lower case (for readability) -Original Message-From: Muhammad Nadeem Ashraf [mailto:[EMAIL PROTECTED]Sent: D

Re: [SQL] can a function return a virtual table?

2005-04-19 Thread KÖPFERL Robert
That was a nice answer - rather compleete. However at least I am questioning myself for a long time about what happens if one does a select from a SRF. The function may return millions of records (i.e. select * from x where a>1). Is this data streamed through the query process or does postgres cre

Re: [SQL] User Defined Functions Errors

2005-04-19 Thread KÖPFERL Robert
Have a try with RAISE NOTE or RAISE EXCEPTION keep in mind that exceptions should be exceptional. So a good idea of whether to use them is to ask 'Do I expect such error' or 'is an explicit error useful for the caller'. I'ts often better to just return an empty relation |-Original Message-

[SQL] btree and is null in a static expression

2005-04-18 Thread KÖPFERL Robert
Hi, I've written a function but I don't understand the the plan, the planner makes. If variables are replaced, the function looks like that: select a,b,c from "Tbl1" where (a='454') or ('454' is null); a has got an btree-Index. explain verbose tells me that Postgres wants to do a SEQSCAN If th

Re: [SQL] Postgres 7.3 migrate to 8.0 date problems.

2005-03-30 Thread Robert Treat
mbers are both <=12, then you'll get one > "date" and if the wrong one is >12 you'll get another. That can't be > good. > Would it be possible to use a BEFORE trigger to reformat the -DD-MM date to -MM-DD ? The error I see on 7.4 is ERROR:

[SQL] save me from an unconstrained join

2005-03-30 Thread Robert Treat
ach software is assigned a "class" based on the size of its binary into a predetermined range of classes that are defined as relative filesizes. The above query really does work... but istm I ought to be joining those tables somehow... any ideas? Robert Treat -- Build A Brighter Lamp ::

Re: [SQL] How does the planner treat a table function.

2005-03-16 Thread KÖPFERL Robert
d. This may mean that (as you asked) a select over a table function produces a temprary table and thus costs much ressources if the table is big. |-----Original Message- |From: KÖPFERL Robert |Sent: Montag, 14. März 2005 12:26 |To: pgsql-sql@postgresql.org |Subject: [SQL] How does the planner t

Re: [SQL] Inserting values in arrays

2005-03-15 Thread Robert . Farrugia
Richard, So the solution can be:         (i) either write a function to insert the values into the array one by one         (ii) or else upgrade to 7.4 (or 8) to use the ARRAY syntax. Thanks a lot. Regards Robert Richard Huxton 03/15/2005 09:08 AM To [EMAIL PROTECTED] cc pgsql

[SQL] Inserting values in arrays

2005-03-14 Thread Robert . Farrugia
x is giving an error.  How can this be done in postgres ? Postgres version I am using is 7.3.4 Regards Robert

[SQL] How does the planner treat a table function.

2005-03-14 Thread KÖPFERL Robert
Hi, we have got some tables (uw?) and functions. One function is defined like get_abc(): SELECT a,b,c from table_x; What happens if I query something like SELECT a,b from get_abc() where a=5; while table_x is rather big? Will PSQL at first query all records of table_x and then apply a where

Re: [SQL] [ADMIN] Postgres schema comparison.

2005-03-09 Thread KÖPFERL Robert
|-Original Message- |From: Goulet, Dick [mailto:[EMAIL PROTECTED] |Sent: Montag, 07. März 2005 16:33 |To: John DeSoi; Stef |Cc: pgsql-ADMIN@postgresql.org; pgsql-sql@postgresql.org |Subject: Re: [SQL] [ADMIN] Postgres schema comparison. | | | My favorite for this task is WinSql available f

[SQL] Lambda expressions in SQL

2005-03-07 Thread KÖPFERL Robert
Coming from functional programming, I often wish to write something like that: (LAMDA "expesiveFcn"(x y z) as exfcn update "Tbl5" SET "Column" = exfcn ) In this case "expensiveFcn" is VOLATILE... Is there a way? At least: substituting the lambda by a select doesn't work with update as

[SQL] Maintaining production DBs, making one schema look like the other

2005-03-07 Thread KÖPFERL Robert
OK, the usual thing: There exists a DB-schema. It is on one hand already in production usage. On the other hand it is still being developed as functions and non-structural stuff are concerned. I found out that EMS Database Comparer helps to replicate the schema differences in form of SQL-statement

  1   2   3   >