Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Scott Marlowe
On Jan 7, 2008 4:37 PM, Emi Lu <[EMAIL PROTECTED]> wrote: > > > > >> select max(col1) from table > >> union all > >> select max(col2) from table > >> union all > >> select max(col3) from table > No, this is not what I prefer; it makes complicate query. Generally speaking when you have to make comp

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Scott Marlowe
On Jan 7, 2008 4:27 PM, Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > --- On Mon, 1/7/08, Scott Marlowe <[EMAIL PROTECTED]> wrote: > > > select max(col1) from table > > union all > > select max(col2) from table > > union all > > select max(co

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Scott Marlowe
On Jan 7, 2008 4:03 PM, Emi Lu <[EMAIL PROTECTED]> wrote: > Greetings, > > Version: PostgreSQL 8.0.13 on i686-pc-linux-gnu > > I have a table test(col1, col2, col3) > > For each row, I'd like to get the "max"(col1, col2, col3). > > For example, test(1, 5, 2) > test(8, 1, 3) >

Re: [SQL] Argentinian timezone change at the last moment. How to change pgsql tz db?

2008-01-02 Thread Scott Marlowe
On Jan 2, 2008 2:49 PM, Joe <[EMAIL PROTECTED]> wrote: > Scott Marlowe wrote: > > I've been reading up on zic and wondering if it's a reasonable thing > > to try and update the pg tz db to include the new argentinian DST > > change. Where is the tz inf

Re: [SQL] Argentinian timezone change at the last moment. How to change pgsql tz db?

2008-01-02 Thread Scott Marlowe
Wow! I just looked this up on the web, and all I can say is, this was a really stupid idea on the part of the govt in Argentina. It takes more than a couple days to create new timezone files and deploy them normally. I've been reading up on zic and wondering if it's a reasonable thing to try

Re: [SQL] PG is in different timezone than the OS

2008-01-02 Thread Scott Marlowe
Carrying on a convo with myself here. Looking in the timezone directory, and looking at the tz database located at ftp://elsie.nci.nih.gov/pub/ it appears the southamerica timezone data was updated 2007-12-13 at 9am or so. Looking through the file it looks like the change was made: # From Steffe

Re: [SQL] PG is in different timezone than the OS

2008-01-02 Thread Scott Marlowe
On Jan 2, 2008 12:43 PM, Fernando Hevia <[EMAIL PROTECTED]> wrote: > Hi all, > > I am not sure if this is the correct list to post this issue. Please let me > know if there is a more suitable one. > > Argentina's government has recently decreted a timezone change for the > summer (daylight's saving

Re: [SQL] SELECT MAX returns wrong value

2007-12-14 Thread Scott Marlowe
On Dec 13, 2007 5:09 PM, Gavin Baumanis <[EMAIL PROTECTED]> wrote: > Hi Everyone, > > Sorry if I am missing something obvious but I think I have found a bug. > If I perform the following SQL > > SELECT MAX(column) FROM table WHERE expression > > and there is no match, Postgres returns a record coun

Re: [SQL] Query design assistance - getting daily totals

2007-12-12 Thread Scott Marlowe
On Dec 12, 2007 12:39 AM, Paul Lambert <[EMAIL PROTECTED]> wrote: > A. Kretschmer wrote: > > am Wed, dem 12.12.2007, um 10:34:35 +0900 mailte Paul Lambert folgendes: > >> year_id integer > >> month_id integer > >> working_day integer > > > > Why this broken data types? We have date and timestamp[t

Re: [SQL] Using schema

2007-11-30 Thread Scott Marlowe
On Nov 30, 2007 9:00 AM, Daniel Caune <[EMAIL PROTECTED]> wrote: > The cool thing with this, compared to the USE statement supported by > some other RDBMS, is that the user is not restricted to one given schema > without explicit schema declaration: > > SELECT * FROM foo;

Re: [SQL] Obtaining the primary key of the record just inserted

2007-11-08 Thread Scott Marlowe
On Nov 8, 2007 11:56 AM, Oliveiros Cristina <[EMAIL PROTECTED]> wrote: > > Hello, All, > > I have the need to know the primary key assigned to a record I've just > INSERTed . > > Is there an easy way to solve this ? > > Similar to SQLServer's SELECT scope_identity() ; ? In 8.2 and up: insert int

Re: [SQL] backup database tablespace with rsync?

2007-10-20 Thread Scott Marlowe
On 10/19/07, chester c young <[EMAIL PROTECTED]> wrote: > postgres A, db 'test', tablespace /pg/test1 > postgres B, db 'test', tablespace /pg/test2 > > tablespace /pg/test1 only has A db 'test' > tablespace /pg/test2 only has B db 'test' > > if > - A and B shut down > - /pg/test1 copied to /pg/test

Re: [SQL] Computed table name in function

2007-10-10 Thread Scott Marlowe
On 10/10/07, Ray Madigan <[EMAIL PROTECTED]> wrote: > I have a problem that I don't know where to look to understand the problem. > > I have a function that I first select to get a table name followed by > another select into on that table name. If someone could tell me where to > look to solve th

Re: [SQL] Intermittent Empty return

2007-09-22 Thread Scott Marlowe
On 9/22/07, John Mulkerin <[EMAIL PROTECTED]> wrote: > I agree its old. I'm working on the upgrade but first need to verify > and then purge some data. > > I tried with and without a semicolon > > However, with a semicolon results in > > Just tried semicolon again.. First time resulted in resul

Re: [SQL] Optimize querry sql

2007-09-14 Thread Scott Marlowe
On 9/14/07, A. Kretschmer <[EMAIL PROTECTED]> wrote: > am Fri, dem 14.09.2007, um 8:36:47 -0500 mailte Scott Marlowe folgendes: > > On 9/14/07, A. Kretschmer <[EMAIL PROTECTED]> wrote: > > > > > And use CURRENT_DATE instead now(). > > > > Out of c

Re: [SQL] Optimize querry sql

2007-09-14 Thread Scott Marlowe
On 9/14/07, A. Kretschmer <[EMAIL PROTECTED]> wrote: > And use CURRENT_DATE instead now(). Out of curiosity, why the advice to switch from now() to CURRENT_DATE? ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your de

Re: [SQL] How to influence the planner

2007-09-04 Thread Scott Marlowe
On 8/31/07, Richard Ray <[EMAIL PROTECTED]> wrote: > Changing to enable_seqscan = on does solve this problem, thanks > Is there some method of crafting a query that will assert my wishes to the > planner > When is enable_seqscan = off appropriate enable_xxx = off are troubleshooting tools. They

Re: [SQL] Postgres 7.4 function

2007-08-29 Thread Scott Marlowe
On 8/29/07, Radhika Sambamurti <[EMAIL PROTECTED]> wrote: > Hi, > I am using a function in postgres 7.4 that returns an integer. > I modified my store procedure (same function and parameters) to point to > another table, and return an int. > But now I am not getting the correct answer only 0. > >

Re: [SQL] Partial index and query plan

2007-08-22 Thread Scott Marlowe
On 8/22/07, Aleksandr Vinokurov <[EMAIL PROTECTED]> wrote: > > create table user_history ( >rec_id SERIAL not null, >date TIMESTAMPnot null, >action INT2 not null, >uid INT4 not

Re: [SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Scott Marlowe
On 8/21/07, Gregory Stark <[EMAIL PROTECTED]> wrote: > "Michael Glaesemann" <[EMAIL PROTECTED]> writes: > > > ERROR: a column definition list is only allowed for functions returning > > "record" > > > > So the *form* is right, but I don't know of an example that works. > > postgres=# create funct

Re: [SQL] Make a SQL statement not run trigger

2007-08-21 Thread Scott Marlowe
On 8/21/07, Jon Collette <[EMAIL PROTECTED]> wrote: > I think this will work for what I need. I have been messing around with > this using select into > > /select True as donothing into temporary table table_trigger_name; > then run statement that I want to be ignored > / > The trigger would have

Re: [SQL] Make a SQL statement not run trigger

2007-08-21 Thread Scott Marlowe
On 8/21/07, Jon Collette <[EMAIL PROTECTED]> wrote: > Is it possible to run an insert,update, or delete and have it not launch > a trigger like it normally would? > > For example could I set a value > DONOTRUN = True; > insert into contacts The closest thing to a session variable for pgsql is

Re: [SQL] Sequences problem

2007-08-17 Thread Scott Marlowe
On 8/17/07, Judith <[EMAIL PROTECTED]> wrote: > Hello everybody, I have a question related with sequences. > > When I init a sesion with my db, if a do the next sentence: > > SELECT currval('pagos_id_pago_seq'); > > > return this: >ERROR: the relation doesn't exist > (or s

Re: [SQL] foreign key pointing to diff schema?

2007-08-10 Thread Scott Marlowe
On 8/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi all. Can i make a FK who points a table in a different schema? Or this > is implemented via a trigger by my own? Sure. just prefix the table name with the schemaname and a . create schema abc; alter user me set search_path='abc', 'pub

Re: [SQL] Race condition in resetting a sequence

2007-08-10 Thread Scott Marlowe
On 8/4/07, Lew <[EMAIL PROTECTED]> wrote: > Steve Midgley writes: > >> The code I provided to reset a primary key sequence is actually part of > >> Ruby on Rails core library - actually they use something very similar > >> to what I originally sent: > ... > >> SELECT setval('#{sequence}', (SELECT C

Re: [SQL] Install two different versions of postgres which should run in parallel

2007-08-10 Thread Scott Marlowe
On 8/10/07, Loredana Curugiu <[EMAIL PROTECTED]> wrote: > Hi all, > > I need to have two different vesions of postgres running in parallel on > different ports. Does anyone knows how to install two different versions > of postgres (7.4.5 and 8.2.4) on the same computer? I am using Linux > opera

Re: [SQL] Increment a sequence by more than one

2007-08-03 Thread Scott Marlowe
Oh, another point. You should run the alter sequence m increment 5000; select nextval('m'); alter sequence m increment 1; one right after the other to reduce the number of 5000 wide holes in your sequence. Or, given the size of bigint, you could just set the increment to 5000 and leave it there

Re: [SQL] Increment a sequence by more than one

2007-08-03 Thread Scott Marlowe
On 8/3/07, Steve Midgley <[EMAIL PROTECTED]> wrote: > Hi Scott, > > Thanks for this info (and Michael too!). > > Let me see if I understand your suggestion. I would run these three > commands in sequence: > > # select nextval('[my_seq_name]'); > returns => 52 [I believe that the sequence is at 52]

Re: [SQL] Increment a sequence by more than one

2007-08-03 Thread Scott Marlowe
On 8/3/07, Steve Midgley <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm writing an import app in a third party language. It's going to use > "copy to" to move data from STDIN to a postgres (8.2) table. There are some > complexities though: it's going to copy the records to a "versioned" table > first

Re: [SQL] Authentification failed

2007-08-01 Thread Scott Marlowe
On 8/1/07, Judith <[EMAIL PROTECTED]> wrote: > Hello everybody!! > > I'm trying in SUSE to connect to a postgres db and this is the error: > > Ident Authentification failed for user <> > > I'm already created the user with createuser root, but the error > persist, I would aprecciate some help

Re: [SQL] How do I connect postgres table structures and view structures to an existing svn repository?

2007-08-01 Thread Scott Marlowe
On 8/1/07, John Mitchell <[EMAIL PROTECTED]> wrote: > I am trying to store schema definitions in version-control which I can do by > saving the definition and then importing into svn, but I would like it > to be automatic , so that when an update occurs to a table or view within > postgres then

Re: [SQL] Connection Limit

2007-07-30 Thread Scott Marlowe
On 7/30/07, Jon Horsman <[EMAIL PROTECTED]> wrote: > Hello, > > I have a server running postgres 7.4.13 and am starting to see errors > "FATAL: connection limit exceeded for non-superusers". > > I'm not sure which one of my applications are hogging all of the > connections, is there a way debug th

Re: [SQL] Informix Schema -> PostgreSQL ?

2007-07-03 Thread Scott Marlowe
Mark Fenbers wrote: I am an ex-Informix convert. Informix used the term "schema" to refer to the SQL-format definition of how a table or view was created. E.g., CREATE TABLE john ( char(8) lid, ...); Some views we have are quite complex (and not created by me) and I want to create a similar

Re: [SQL] subtract a day from the NOW function

2007-06-07 Thread Scott Marlowe
Campbell, Lance wrote: Michael, So based on your feedback would it be better to do option A or B below? 1) I have a timestamp field, "some_timestamp", in table "some_table". 2) I want to compare field "some_timestamp" to the current date - 1 day. I need to ignore hours, minutes and seconds.

Re: [SQL] query to select a linked list

2007-05-09 Thread Scott Marlowe
On Wed, 2007-05-09 at 08:29, Aaron Bono wrote: > On 5/9/07, Louis-David Mitterrand <[EMAIL PROTECTED]> > wrote: > Hi, > > To build a threaded forum application I came up the following > schema: > > forum > -- > id_forum | integer

Re: [SQL] query to select a linked list

2007-05-09 Thread Scott Marlowe
On Wed, 2007-05-09 at 08:24, Gregory Stark wrote: > "Louis-David Mitterrand" <[EMAIL PROTECTED]> writes: > > > Each message a unique id_forum and an id_parent pointing to the replied > > post (empty if first post). > > > > How can I build an elegant query to select all messages in a thread? > >

Re: [SQL] Question on interval

2007-04-20 Thread Scott Marlowe
On Fri, 2007-04-20 at 13:53, Wei Weng wrote: > Hi all. > > How do I write a query that converts an interger to the interval type? > > Like convert integer 10 to INTERVAL '10 seconds'? > > The integer is a column in a table though, so it is more like convert > integer tbl.theInteger to INTERVAL

Re: [SQL] Retrieve month from date

2007-04-20 Thread Scott Marlowe
On Fri, 2007-04-20 at 12:30, RPK wrote: > What this query will return: > > Select Extract(Month from 4/20/2007) from dual; > > I suspect "dual" is not for PGSQL but Oracle. But I need to run the above > query. What is the replacement of "dual" in PGSQL. > Well, you're going to have to create a

Re: [SQL] Generating dates prior to generate_series

2007-04-05 Thread Scott Marlowe
On Wed, 2007-04-04 at 07:00, Roger Tannous wrote: > I'm using PostgreSQL version 7.3.2, and generate_series() is not > available, so this is a function to generate a series dates. > > The function goes backwards if the second argument is less than the first > one. Check the two select statements a

Re: [SQL] Serial

2007-04-03 Thread Scott Marlowe
On Tue, 2007-04-03 at 04:20, Shavonne Marietta Wijesinghe wrote: > Ok so i'm posting alot in the forums. Anyway for a change i have > another problem ^___^ > > I have a table that has a field n_gen serial NOT NULL > > ermm let me explain. I have 5 records inserted (n_gen = 1, 2, 3, 4, 5) > >

Re: [SQL] Sequence vs Serial

2007-04-01 Thread Scott Marlowe
Daniel CAUNE <[EMAIL PROTECTED]> Said: > I was wondering when it is better to choose sequence, and when > it is better to use serial. The serial type is a sequence with > default parameters (http://www.postgresql.org/docs/8.2/static/datatype-numeric.html#DATATYPE-SERIAL). > Actually, I never

Re: [SQL] Alter Table

2007-03-15 Thread Scott Marlowe
On Thu, 2007-03-15 at 08:35, Shavonne Marietta Wijesinghe wrote: > When i alter a table and add a new column it always adds it to the end > of the table. Is there any way to tell it to add the new column at the > 5th position or to add the new column after a surtain column. No, but the good news i

Re: [SQL] postgres configuration

2007-03-13 Thread Scott Marlowe
On Tue, 2007-03-13 at 15:48, Sumeet wrote: > On 3/13/07, Andrej Ricnik-Bay <[EMAIL PROTECTED]> wrote: > On 3/14/07, Sumeet <[EMAIL PROTECTED]> wrote: > > Hi All, > Hi, > > > Sorry if this is the wrong list to ask this question. > General woould have

Re: [SQL] index not being used. Why?

2007-03-09 Thread Scott Marlowe
On Fri, 2007-03-09 at 09:01, Gerardo Herzig wrote: > Hi all. I have this 2 relations > SNIP >Index Cond: ((upper((word)::text) ~>=~ 'TEST'::character > varying) AND (upper((word)::text) ~<~'TESU'::character varying)) >-> Hash (cost=9.08..9.08 rows=408 width=55) >

Re: [SQL] system tables inquiry & db Link inquiry

2007-02-28 Thread Scott Marlowe
On Wed, 2007-02-28 at 12:19, Karthikeyan Sundaram wrote: > Hi, > > We are using Postgres 8.1.0 Stop. Do not pass go, do not collect $200. Update your postgresql installation now to 8.1.8. There were a lot of bugs fixed between 8.1.0 and 8.1.8. After that... > Question No 1: > ===

Re: [SQL] Change Default Database

2007-02-26 Thread Scott Marlowe
On Mon, 2007-02-26 at 16:02, Rommel the iCeMAn wrote: > I seem to be blundering a lot today! I thought I was replying to the entire > list, didn't realize I replied to one person :-) > > Nothing was wrong with my script, I assumed that since it was generated by > pgAdmin that I could run it inside

Re: [SQL] Change Default Database

2007-02-26 Thread Scott Marlowe
On Mon, 2007-02-26 at 14:52, Rommel the iCeMAn wrote: > Hi again, > > Apologies for the HTML. > > This is an SQL script, it was generated by doing a schema-only database dump > using pgAdminIII (which in turn uses pgdump I believe). I've attached the > entire script. I was attempting to run this

Re: [SQL] Change Default Database

2007-02-26 Thread Scott Marlowe
On Mon, 2007-02-26 at 10:52, Rommel the iCeMAn wrote: > Hi list, > > I wrote a database creation script that begins with commands to drop > the existing database (if it exists) and create it from scratch. These > commands execute fine, the problem is that all subsequent commands are > executed on

Re: [SQL] how do I to generate a sequence Range or Set of integer constants

2007-02-23 Thread Scott Marlowe
On Fri, 2007-02-23 at 12:25, Stefan Becker wrote: > dear SQL friends, > > What I want to do might be done differantly. Right now I can't > think of another solution other than a select statement > > I would like to create a sequence range of integer constants. Join > this sequence against a ID

Re: [SQL] cartesian product

2007-02-19 Thread Scott Marlowe
On Mon, 2007-02-19 at 10:58, Salman Tahir wrote: > Hi, > > I have a query regarding an SQL statement I'm trying to execute. I > have the following table: > > sequence > -+ > AK > AKCMK > CMKA > > I execute the following statement (Cartesian product): > > SELECT p1.sequence as sequen

Re: [SQL] cartesian product

2007-02-19 Thread Scott Marlowe
On Mon, 2007-02-19 at 10:58, Salman Tahir wrote: > Hi, > > I have a query regarding an SQL statement I'm trying to execute. I > have the following table: > > sequence > -+ > AK > AKCMK > CMKA > > I execute the following statement (Cartesian product): > > SELECT p1.sequence as sequen

Re: [SQL] [ADMIN] Deadlock on transaction

2007-02-12 Thread Scott Marlowe
On Mon, 2007-02-12 at 12:08, Ezequias Rodrigues da Rocha wrote: > I mean really deadlock. Other transactions can't access the database > until the main transaction is complete. A question: > > PostgreSQL doesn't permit multiple transactions concurrently ? Again, that's not a deadlock. A deadlock

Re: [SQL] [ADMIN] Deadlock on transaction

2007-02-12 Thread Scott Marlowe
On Mon, 2007-02-12 at 11:43, Ezequias Rodrigues da Rocha wrote: > Hi list, > > I am curious becouse I am seen my postgresql locking the transactions > when i load a huge (in some case not to huge) numbers of records > 70,000 records. > > Could someone help me with it ? Are sure that what you're

Re: [SQL] Droping indexes

2007-01-16 Thread Scott Marlowe
On Tue, 2007-01-16 at 07:51, Mario Behring wrote: > Hi all, > > Please, if I drop all indexes from a table, can I recreate them after > performing a vacuum full at this table? I mean, I do not know details > about the indexes, so what I am asking is if I issue a REINDEX on this > table, will it c

Re: [SQL] deleting records from a table

2007-01-12 Thread Scott Marlowe
On Fri, 2007-01-12 at 11:45, Mario Behring wrote: > Hi all, > > Simple question: once I execute the delete statement, does it free > disk space immediatelly? Does Postgres uses something like a datafile > with a pre-defined size like Oracle does?? > Take a look here: http://www.postgresql.org/do

Re: [SQL] Nested select

2006-11-07 Thread Scott Marlowe
On Mon, 2006-11-06 at 05:08, Hubert Retif wrote: > Hi, > > > > I am migrating my application from MySQL to Postgresql and have met > following situation: > SELECT > (sum(sold_price)/(select sum(sold_price) from car_archive))*100 as > CA_pcent, > reason_text > FROM car_archive > group by reason

Re: [SQL] fetching unique pins in a high-transaction environment...

2006-11-06 Thread Scott Marlowe
On Mon, 2006-11-06 at 14:04, Richard Broersma Jr wrote: > > Best practice, to me, is to do a couple things. One, create a sequence > > and set it to the first available pin number. Let's say you have pins > > available from the number 1 to . Create a default sequence, it'll > > start on 1.

Re: [SQL] Database recovery in postgres 7.2.4.

2006-11-06 Thread Scott Marlowe
On Mon, 2006-10-30 at 04:25, Santosh wrote: > Hi All. > > My setup is as follows: > OS: Sun Solaris 5.8. > Postgres: 7.2.4 Just so you know, 7.2 is ancient. You should, at a minimum be running the latest 7.2 release, 7.2.8. You should really look into upgrading to a later version as soon as poss

Re: [SQL] fetching unique pins in a high-transaction environment...

2006-11-06 Thread Scott Marlowe
On Sun, 2006-10-29 at 10:36, Bobus wrote: > Hi, > > I posted this question to the "general" forum, but then discovered this > one which I think is more appropriate. Apologies for the cross-post. > > We are in the process of porting an application from SQL Server to > PostgresQL. > > We have a t

Re: [SQL] How to query information schema from shell script

2006-10-27 Thread Scott Marlowe
On Fri, 2006-10-27 at 10:12, Jon Horsman wrote: > In my original email i forgot to mentioned i need to know if the > database exists or not from the shell script. If it doesn't exist i > would then create it. Currently i was just creating the db everytime > our db script is run (since it doesn't

Re: [SQL] i have table

2006-10-04 Thread Scott Marlowe
On Wed, 2006-10-04 at 13:02, Aaron Bono wrote: > On 10/4/06, Daryl Richter <[EMAIL PROTECTED]> wrote: > On 10/4/06 12:20 PM, "Aaron Bono" <[EMAIL PROTECTED]> > wrote: > > > > So do it as needed and convert your application slowly. > > > > I just name

Re: [SQL] Group by minute

2006-09-22 Thread Scott Marlowe
On Fri, 2006-09-22 at 10:52 -0300, Ezequias Rodrigues da Rocha wrote: > Hil list, > > I have a query but my IDE (Delphi) does not accept "to_char" > capability. Is there a way to reproduce the same query without using > to_char function ? > > Here is my query: > SELECT to_char(quando,'dd/MM/

Re: [SQL] help with pagila

2006-09-01 Thread Scott Marlowe
On Fri, 2006-09-01 at 12:26, Walter Cruz wrote: > So I can assume that the MySQL implementation is strange? (It accepts > that kind of query) Yes, according to the SQL spec, you should generally get an error when you run a query like this: select field1, field2 from table group by field1 since y

Re: RES: [SQL] Lock Problem

2006-08-24 Thread Scott Marlowe
On Thu, 2006-08-24 at 16:12, André José Guergolet wrote: > Sorry, I have a table with 360 rows, in this table I control the state of > machines on network: > > > IpState StateDate > 172.20.0.39 Running 2006-08-23 00:00:00 > 172.20.0.59 Running 20

Re: [SQL] SQL92 compliance

2006-08-23 Thread Scott Marlowe
On Wed, 2006-08-23 at 12:40, Tom Lane wrote: > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > Am Mittwoch, 23. August 2006 03:40 schrieb Daniel CAUNE: > >> Is AS in "SELECT my_column AS my_name FROM my_table" mandatory to be SQL92 > >> compliant? > > > No. I have a patch at > >

Re: [SQL] Breaking up a query

2006-08-15 Thread Scott Marlowe
On Thu, 2006-08-10 at 17:53, Saad Anis wrote: > Hi Guys, > > A fellow at work has written the SQL below to retrieve some data from > multiple tables. Obviously it is inefficient and unnecessarily complex, and > I am trying to break it into 2 or more queries so as to enhance performance. Nope, tha

Re: [SQL] Query response time

2006-08-15 Thread Scott Marlowe
On Fri, 2006-08-11 at 08:58, Jonathan Sinclair wrote: > Hi all. Thanks for your help so far. However after configuring my system > I am still getting major lag times with a couple of queries. The first, > which suffers from the '538/539'(see old email included below) bug, is > caused by running the

Re: [SQL] how do I check for lower case

2006-08-10 Thread Scott Marlowe
On Thu, 2006-08-10 at 15:32, Juliann Meyer wrote: > I have a table with a column, lets call it identifier, that is defined > as varchar(8) that should never contain lower case letters. Its a large > table. Is there a way to query the table to see if any values in this > column are lower case a

Re: [SQL] viewing the description of tables from python DB-API

2006-08-02 Thread Scott Marlowe
On Tue, 2006-08-01 at 18:14, Rodrigo De Leon wrote: > On 8/1/06, Daniel Joo <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > > > > > Is there a way to view the list of all tables from python (or any other > > languages for that matter) DB-API? What I'm looking for is a command > > similar to the met

Re: [SQL] primary keys as TEXT

2006-07-28 Thread Scott Marlowe
On Fri, 2006-07-28 at 03:37, Manlio Perillo wrote: > Hi. > > There can be performancs problems in having primary keys of type TEXT? > What about having a primary key of 3 columns (all of type TEXT)? The biggest problem with using text as a primary key or foreign key is that text types are locale

Re: [SQL] Disk is full, what's cool to get rid of?

2006-07-27 Thread Scott Marlowe
I can't tell you the number of times that little trick has saved my life. On Thu, 2006-07-27 at 11:32, Jeff Frost wrote: > You can probably just "tune2fs -m 0 " to give yourself enough > space to get out of the jam before you go deleting things. Then you might > want to vacuum full afterwards.

Re: [SQL] System catalog table privileges

2006-07-21 Thread Scott Marlowe
On Fri, 2006-07-21 at 11:19, Hilary Forbes wrote: > Aaron > > Thanks for this one - I had actually wondered about doing that but the > trouble is that they say that they need up to the minute reports not > "as of last night". Indeed, I do have another app where I do just > that because I find tha

Re: [SQL] How to find entries missing in 2nd table?

2006-07-12 Thread Scott Marlowe
On Wed, 2006-07-12 at 03:06, Exner, Peter wrote: > Hi, > > what about > > SELECT controller_id FROM control > WHERE controller_id NOT IN > (SELECT DISTINCT controller_id FROM datapack); That one works too, but it's generally not as fast as the left join / is null query on large tables. Give th

Re: [SQL] How to find entries missing in 2nd table?

2006-07-11 Thread Scott Marlowe
On Tue, 2006-07-11 at 09:19, [EMAIL PROTECTED] wrote: > Hi, > I realize I probably lost my marbles but I've been having a god > awful time with a single query: > > control: > > > controller_id pk; > > > datapack: > > controller_id fk; > >

Re: [SQL] MS-SQL<->Postgres sync

2006-07-10 Thread Scott Marlowe
ould work. Didnt look real hard though. > > Kevin > > > -Original Message- > From: Scott Marlowe <[EMAIL PROTECTED]> > To: "Forums @ Existanze" <[EMAIL PROTECTED]> > Cc: pgsql-sql@postgresql.org >

Re: [SQL] MS-SQL<->Postgres sync

2006-07-10 Thread Scott Marlowe
On Mon, 2006-07-10 at 11:25, Andrew Sullivan wrote: > On Mon, Jul 10, 2006 at 11:27:52AM -0400, Kevin Bednar wrote: > > Looking to keep 2 databases in sync, at least semi-realtime if possible, > > although running a batch update every x mins wouldn't be out of the > > question. One db is postgres

Re: [SQL] MS-SQL<->Postgres sync

2006-07-10 Thread Scott Marlowe
Look at slony. On Mon, 2006-07-10 at 11:06, Forums @ Existanze wrote: > > We are looking for the exact thing but with two PostgreSQL databases > > > __ > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTEC

Re: [SQL] Atomar SQL Statement

2006-07-07 Thread Scott Marlowe
On Fri, 2006-07-07 at 13:07, Stephan Szabo wrote: > On Fri, 7 Jul 2006, Michael Glaesemann wrote: > > > > > On Jul 7, 2006, at 7:55 , Weber, Johann (ISS Kassel) wrote: > > > > > My concern: in a multi threaded environment, can a second thread > > > interrupt this statement and eventually insert th

Re: [SQL] Alternative to serial primary key

2006-07-07 Thread Scott Marlowe
On Fri, 2006-07-07 at 03:07, David Clarke wrote: > Yep, this was pretty much where I started from and I totally agree > with you regarding premature optimisation. I would point out that md5 > hash is 128 bits or 16 bytes and not 32 Unless you're going to store them as a binary field, the standar

Re: [SQL] Alternative to serial primary key

2006-07-06 Thread Scott Marlowe
On Thu, 2006-07-06 at 16:45, Sander Steffann wrote: > Hi, > > > But having a hash function over the address > > column as the primary key means I can always regenerate my primary key > > Warning: don't attach a meaning to a primary key, as it might change And as long as it has cascading updates

Re: [SQL] Alternative to serial primary key

2006-07-06 Thread Scott Marlowe
On Thu, 2006-07-06 at 16:43, Aaron Bono wrote: > On 7/6/06, David Clarke <[EMAIL PROTECTED]> wrote: > To recap, yes there is only a single column, yes it is > varchar. I need > to do a lookup on the address column which is unique and use > it as a > foreign k

Re: [SQL] Alternative to serial primary key

2006-07-06 Thread Scott Marlowe
On Thu, 2006-07-06 at 05:16, David Clarke wrote: > I posted a couple of weeks back a question regarding the use of a 100 > char column as a primary key and the responses uniformily advised the > use of a serial column. My concern is that the key is effectively > abstract and I want to use the colum

Re: Fwd: [SQL] Start up question about triggers

2006-06-26 Thread Scott Marlowe
On Mon, 2006-06-26 at 08:59, Forums @ Existanze wrote: > Hello again, > > The problem is not tracking WHAT changed, this can be done, as we have > discussed in this thread, the problem is how to replicate the necessary > commands that will alter a mirror database to reflect what has been changed,

Re: [SQL] empty set

2006-06-08 Thread Scott Marlowe
On Thu, 2006-06-08 at 16:40, CG wrote: > PostgreSQL 8.1 > > I've been trying to write a SQL prepare routine. One of the challenging > elements I'm running into is an empty set ... > > "select foo from bar where foo in ? ;" > > What if "?" is an set with zero elements? What is the proper value to

Re: [SQL] How to get list of days between two dates?

2006-06-06 Thread Scott Marlowe
On Tue, 2006-06-06 at 16:17, Aaron Bono wrote: > Though there may be a more eligant way to do it, when we did things > like this in the past we created a function (or stored procedure) that > got the min and max dates and then created a result set that iterated > through the dates to create a virtu

Re: [SQL] Advanced Query

2006-06-06 Thread Scott Marlowe
On Tue, 2006-06-06 at 10:30, Richard Broersma Jr wrote: > > Personally: I think your posts are getting annoying. This isn't SQLCentral. > > Learn to write your own damn queries or even better - buy a book on SQL... > > Personally: (being a newbie with an interest in developing a strong rdms > sk

Re: [SQL] Am I crazy or is this SQL not possible

2006-06-01 Thread Scott Marlowe
On Thu, 2006-06-01 at 14:47, Yasir Malik wrote: > > It is a hack, but when someone wants you to do something in a way > > different from the norm, aren't they asking for a hack? > > > > SQL Server does something like > > select top (1) from > > > > I am thinking this is NOT a SQL-99 standard.

Re: [SQL] Find min and max values across two columns?

2006-05-15 Thread Scott Marlowe
On Mon, 2006-05-15 at 16:40, Emi Lu wrote: > Hello, > > I tried "select greatest(max(a), max(b)) from public.test", but I got > the following errors: > > ERROR: function greatest(integer, integer) does not exist > HINT: No function matches the given name and argument types. You may > need to

Re: [SQL] LinkedList

2006-04-26 Thread Scott Marlowe
On Wed, 2006-04-26 at 11:09, Ray Madigan wrote: > I have a table that I created that implements a linked list. I am not an > expert SQL developer and was wondering if there are known ways to traverse > the linked lists. Any information that can point me in the direction to > figure this out would

Re: [SQL] How to copy data between joined columns?

2006-04-07 Thread Scott Marlowe
On Fri, 2006-04-07 at 15:32, Bryce Nesbitt wrote: > I have a need to copy/update data from one column to another, based on a > join condition. Is this easy to do in pure SQL? I have google'ed > without luck for a easy solution (that's not Microsoft specific, that > is). For example: > > postgre

Re: [SQL] Flight numbers data

2006-03-29 Thread Scott Marlowe
On Wed, 2006-03-29 at 02:17, Achilleus Mantzios wrote: > Hi, i am in the process of writing an application about > tickets, flights, etc, and i am thinking of getting the primitive > data ready at the begining and doing it the right way, > (e.g. the user will just select a flight number and doesnt

Re: [SQL] generate_series to return row that doesn't exist in

2006-03-24 Thread Scott Marlowe
On Fri, 2006-03-24 at 14:30, MaXX wrote: > Hi, > > I have a table wich contains aggregated data, > table stats_activity > logtime timestamptz, > count int > > given this dataset > "2006-03-24 03:00:00+01";55 > "2006-03-24 04:00:00+01";33 > "2006-03-24 06:00:00+01";46 > "2006-03-24 07

Re: [SQL] Referential integrity broken (8.0.3), sub-select help

2006-03-21 Thread Scott Marlowe
On Tue, 2006-03-21 at 08:58, [EMAIL PROTECTED] wrote: > Hello, > > I've got 2 tables, "url" (U), and "bookmark" (B), with "bookmark" pointing to > "url" via FK. > Somehow I ended up with some rows in B referencing non-existent rows in U. > This sounds super strange and dangerous to me, and it's n

Re: [SQL] have you feel anything when you read this ?

2006-03-20 Thread Scott Marlowe
On Mon, 2006-03-20 at 02:06, Eugene E. wrote: > http://dev.mysql.com/doc/refman/5.0/en/news-5-0-19.html > --- cut --- > mysql no longer terminates data value display when it encounters a NUL > byte. Instead, it displays NUL bytes as spaces. (Bug #16859) > --- cut --- Everyone here realizes that t

Re: [HACKERS] [SQL] Interval subtracting

2006-03-08 Thread Scott Marlowe
On Wed, 2006-03-08 at 06:07, Markus Schaber wrote: > Hi, Scott, > > Scott Marlowe wrote: > > >>But it isn't '-2 months, -1 day'. I think what you are saying is what I > >>am saying, that we should make the signs consistent. > > Pretty much.

Re: [SQL] pg_dump and diffrent sizes

2006-03-03 Thread Scott Marlowe
On Fri, 2006-03-03 at 14:10, Maciej Piekielniak wrote: > Hello pgsql-sql, > > I dump db with pg_dump v.8.1.3 on database postgresql server 7.4.7. > Data directory with my db on pg 7.4.7 had 1,8GB and > file with dump had 2,7GB. > Database have blob fields. > > When I restore db on pg 8.1 - data d

Re: [HACKERS] [SQL] Interval subtracting

2006-03-01 Thread Scott Marlowe
On Wed, 2006-03-01 at 14:27, Bruce Momjian wrote: > Scott Marlowe wrote: > > On Wed, 2006-03-01 at 14:18, Bruce Momjian wrote: > > > Stephan Szabo wrote: > > > > > justify_days doesn't currently do anything with this result --- it > > > > > thi

Re: [SQL] Interval subtracting

2006-03-01 Thread Scott Marlowe
On Wed, 2006-03-01 at 14:18, Bruce Momjian wrote: > Stephan Szabo wrote: > > > justify_days doesn't currently do anything with this result --- it > > > thinks its charter is only to reduce day components that are >= 30 days. > > > However, I think a good case could be made that it should normalize

Re: [SQL] Replication - state of the art?

2006-03-01 Thread Scott Marlowe
On Wed, 2006-03-01 at 11:51, Bryce Nesbitt wrote: > I'm interested in creating a mirror database, for use in case one our > primary machine goes down. Can people here help sort out which of the > several replication projects is most viable? > > As far as I can tell, the winner is slony1 at > http

Re: [SQL] Update in all tables

2006-02-22 Thread Scott Marlowe
On Wed, 2006-02-22 at 15:13, Andrew Sullivan wrote: > On Wed, Feb 22, 2006 at 11:59:06AM -0600, Judith Altamirano Figueroa wrote: > > Hello everybody I need to update a field with the same value in the > > tables of my data base but this field exists in almost all tables and > > has the same va

<    1   2   3   4   >