Re: [SQL] wired behaviour

2008-11-28 Thread Ragnar Hafstað
On fös, 2008-11-28 at 15:22 +0100, Lutz Steinborn wrote: Hello Paul, thanks for the quick answer. NULL values? Jepp, thats it. I've supposed this but can't believe it. So NULL is something out of this dimension :-) Yes, that is one way of putting it. A more useful way to look at it

Re: [SQL] DELETE with JOIN

2008-08-07 Thread Ragnar
On fim, 2008-08-07 at 09:14 -0700, [EMAIL PROTECTED] wrote: I want to delete with a join condition. Google shows this is a common problem, but the only solutions are either for MySQL or they don't work in my situation because there are too many rows selected. I also have to make this work

Re: [SQL] How to creat tables using record ID in for loop

2008-08-06 Thread Ragnar
On mið, 2008-08-06 at 18:52 +, CHUNRIMACHUNRIMA wrote: 96784002;mylocation #1 02385067;mylocation #2 01734056;mylocation #3 ... 3. What I want to do is to create tables with staid from mytest table using for loop. ... +++Example+++ CREATE TABLE s06784000 ( staid varchar(50),

Re: [SQL] Problem in dynamic query execution in plpgsql

2008-07-12 Thread Ragnar
On lau, 2008-07-12 at 14:45 +0530, Anoop G wrote: Hai Kretschmer , Thanks for your reply, it help to solve my problem. I have few for doubts regarding dynamic query ... vchr_query:= 'SELECT mf,sf,(mf – mf * comm /100) – (sf – sf * comm/100) as flt_claim'; the '–' characters here probably

Re: [SQL] Returning array of IDs as a sub-query with group-by

2007-08-25 Thread Ragnar
On lau, 2007-08-25 at 17:55 +0200, Andreas Joseph Krogh wrote: On Saturday 25 August 2007 17:10:57 Andreas Joseph Krogh wrote: [snip] count | item_id | price | item_id_array ---+-+---+--- 3 | 1 | 100 | {1,2,3} 6 | 1 | 200 |

Re: [SQL] Range of caracters

2007-08-07 Thread Ragnar
On þri, 2007-08-07 at 10:07 -0700, Wilton Wonrath wrote: Data Table Inicial - Final 9C2HB02107R008000 9C2HB02107R008200 FAIXA1FAIXA100 I´m doing the following

Re: [SQL] data dependent sequences?

2007-07-15 Thread Ragnar
On sun, 2007-07-15 at 09:28 -0600, Stuart McGraw wrote: Advice requested :-) I have a table like: CREATE TABLE items ( id INT, typ INT... PRIMAY KEY (seq,typ)); I would like 'id' to be like a SERIAL except that I want independent sequences for each value of 'typ'. what

Re: [SQL] Using case or if to return multiple rows

2007-07-12 Thread Ragnar
On fim, 2007-07-12 at 12:15 +0530, Ashish Karalkar wrote: I want to select data from two diffrent table based on third tables column somthing like: select case when t3.date='' then select * from table1 else select * from table 2 from

Re: [SQL] yet another simple SQL question

2007-06-25 Thread Ragnar
On mán, 2007-06-25 at 12:44 -0500, Joshua wrote: I have a column that looks like this firstname - John B Mark A Jennifer D Basically I have the first name followed by a middle initial. Is there a quick command I can run to strip the middle initial? how about:

Re: [SQL] join problem

2007-06-24 Thread Ragnar
On sun, 2007-06-24 at 06:14 -0500, A. R. Van Hook wrote: [ in the future, please avoid top-posting, as it is annoying to have to rearrange lines when replying ] Ragnar wrote: On lau, 2007-06-23 at 04:15 -0500, A. R. Van Hook wrote: Ragnar wrote: On fim, 2007-06-21 at 08:46 -0500, A. R

Re: [SQL] join problem

2007-06-23 Thread Ragnar
On lau, 2007-06-23 at 04:15 -0500, A. R. Van Hook wrote: Ragnar wrote: On fim, 2007-06-21 at 08:46 -0500, A. R. Van Hook wrote: If I try an inclusive query using the following: select sum(i.rowtot + i.tax) as tot, sum(v.deposit) as deposit from cai c join

Re: [SQL] join problem

2007-06-21 Thread Ragnar
On fim, 2007-06-21 at 08:46 -0500, A. R. Van Hook wrote: if I query for the total deposit using select sum(deposit) from invoice where cusid = 2128 I also get 1179.24, also the correct amount If I try an inclusive query using the following: select sum(i.rowtot +

Re: [SQL] How to find missing values across multiple OUTER JOINs

2007-06-06 Thread Ragnar
On þri, 2007-06-05 at 23:55 -0700, Drew wrote: I'm having troubles using multiple OUTER JOINs, which I think I want to use to solve my problem. My problem is to find all non-translated string values in our translations database, given the 4 following tables: SOURCE (source_id PRIMARY

Re: [SQL] hi

2007-04-24 Thread Ragnar
On þri, 2007-04-24 at 17:39 +0530, Penchalaiah P. wrote: Hi I have the data like this in temp table SQL Select sno, value from temp; you seem to be assuming a specific order for this. gnari ---(end of broadcast)--- TIP 9: In versions

Re: [SQL] How to reduce a database

2006-12-29 Thread Ragnar
On fös, 2006-12-29 at 07:09 -0800, Mario Behring wrote: Anyway, the openNMS database is very large now, more than 25GB (considering all tables) and I am starting to have disk space issues. The openNMS product has a vacuumdb procedure that runs every 24 hours and reads a

Re: [SQL] Changing character set when the damage is done

2006-12-22 Thread Ragnar
On lau, 2006-12-23 at 00:12 +0100, Alexis Paul Bertolini wrote: I set up a DB with default values and it now uses the SQL_ASCII character set (as per show client_encoding;). I have copied in quite a lot of data from various Access databases but only now have I realized that all accented

Re: [SQL] Fetching BLOBs

2006-12-20 Thread Ragnar
On mið, 2006-12-20 at 08:55 +0530, Ashish Ahlawat wrote: I have a very intersting question to all of you. Pls help me to build this query, I want to fetch more that 70,000 BLOB from different customer servers. the issue is there are some BOLB files with common names on all servers. So I want

Re: [SQL] join/group/count query.

2006-12-20 Thread Ragnar
On mið, 2006-12-20 at 10:12 +, Gary Stainburn wrote: Hi folks. I have the following query which works for me at the moment. However, o_model refers to a table stock_models which has one record for each model type. At the moment if I another record to the stock_models I have to amend

Re: [SQL] SELECT with WHERE clause by column number

2006-12-18 Thread Ragnar
On mán, 2006-12-18 at 09:17 -0800, Carlos Santos wrote: SELECT id FROM myTable WHERE column-number = 'value'; (PS: The id column is the primary key of myTable). That is a select using column number in the WHERE clause what don't exists in SQL. I need this because there's a situation in

Re: [SQL] Need to subtract values between previous and current row

2006-12-15 Thread Ragnar
On fös, 2006-12-15 at 18:27 +0600, Partha Guha Roy wrote: Hi, I have a table that contains data like this: ID ATIME (MM/dd/) == 110/12/2006 210/14/2006 310/18/2006 410/22/2006 510/30/2006 Now I

Re: [SQL] Need to subtract values between previous and current row

2006-12-15 Thread Ragnar
On fös, 2006-12-15 at 19:21 +0600, Partha Guha Roy wrote: Thanks for everyones email. Let me clarify a little bit more. Actually there is a state change of an entity. now the results are stored in the following manner: CIDATIME STATE 10112/10/2006 1 101

Re: [SQL] Need to subtract values between previous and current row

2006-12-15 Thread Ragnar
On fös, 2006-12-15 at 06:01 -0800, Richard Broersma Jr wrote: CIDATIME STATE 10112/10/2006 1 10112/12/2006 2 10112/14/2006 1 10112/17/2006 2 10212/14/2006 1 10212/16/2006 2 102

Re: [SQL] join and sort on 'best match'

2006-12-15 Thread Ragnar
On fös, 2006-12-15 at 22:10 +0530, Ashish Ahlawat wrote: Hi team I was just asking that If table ITEM3 has all the columns then why we need to have a join ?? even we put a sorting very easily. On 12/14/06, Markus Schaber [EMAIL PROTECTED] wrote: Hi, Ashish,

Re: [SQL] Unions and Grouping

2006-12-15 Thread Ragnar
On fös, 2006-12-15 at 16:17 -0600, Aaron Bono wrote: On 12/15/06, Tom Lane [EMAIL PROTECTED] wrote: Aaron Bono [EMAIL PROTECTED] writes: My question, what do the SQL Specifications say should happen on a Union? Is it supposed to eliminate duplicates even

Re: [SQL] join a lot of columns of two tables

2006-12-14 Thread Ragnar
On fim, 2006-12-14 at 12:01 +0100, ivan marchesini wrote: Dear Postgres Users, I have 2 tables... each one has a column called ID (primary keys of each table) the values into each ID column are exactly the same. each table has a lot of other columns (around 50 for each table) I would

Re: [SQL] join and sort on 'best match'

2006-12-13 Thread Ragnar
On mið, 2006-12-13 at 10:26 +0100, Dirk Griffioen wrote: I have been breaking my head on the following problem: how to join 2 tables and sort the results on the best match. ^ - there are 3 tables, items, tags and items_tags. The items_tags table links items to tags. - I have

Re: [SQL] Using Control Flow Functions in a SELECT Statement

2006-12-05 Thread Ragnar
[ removing a bunch of probably uninterested people from CC ] On mán, 2006-12-04 at 22:12 +0530, Ashish Ahlawat wrote: Hi Team Thanks FOR your prompt responseBut USING CASE issue still NOT resolvedOracle prompts same error. this is a postgresql mailing list, but I believe that

Re: [SQL] UNICODE and PL/PGSQL

2006-11-28 Thread Ragnar
On þri, 2006-11-28 at 09:14 +0100, Bart Degryse wrote: Yes, I tried and it didn't work. PostgreSQL surely makes something of it, but not the right characters. maybe you should show us exacly what you did, and what you got, and what you expected Unless Markus can make his idea using decode

Re: [SQL] UNICODE and PL/PGSQL

2006-11-27 Thread Ragnar
On mán, 2006-11-27 at 11:52 +0100, Bart Degryse wrote: Dear all, This works: SELECT '\x65'; = it returns the letter 'e'. yes, but: test=# select '\x'||'65'; ?column? -- x65 (1 row) When I do the following in PL/PGSQL FOR i IN 101..101 LOOP charset := charset || '\x'

Re: [SQL] UNICODE and PL/PGSQL

2006-11-27 Thread Ragnar
On mán, 2006-11-27 at 15:54 +0100, Bart Degryse wrote: Hi gnari, I suppose your statement test=# select '\x'||'65'; is done on some command line interface. I don't have that. I can only use some client program. I'm using EMS SQL Manager 2007 and pgAdmin III 1.3 None of them accepts your

Re: [SQL] tree-structured query

2006-09-30 Thread Ragnar
On fös, 2006-09-29 at 15:00 -0700, chester c young wrote: in a simple tree structured table table t( id primary key, pnt_id references t( id ), name ); does anyone know an easy howbeit sneaky way of determining ancestory and decendency without recursive functions, how about

Re: [SQL] [HACKERS] lower() not working correctly...?

2006-09-15 Thread Ragnar
On fös, 2006-09-15 at 09:52 +0200, Andreas Joseph Krogh wrote: I have the following query: select lower(firstname) || ' ' || lower(lastname) from person firstname and lastname are VARCHAR lower() returns NULL when firstname OR lastname is NULL, is this correct? In fact, your problem has

[SQL] case insensitive regex clause with some latin1 characters fails

2006-09-11 Thread Ragnar Österlund
what the problem might be? /Ragnar ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Is it possible to left join based on previous joins

2006-09-07 Thread Ragnar
On fim, 2006-09-07 at 10:02 -0400, Emi Lu wrote: I tried the example as the following: create table a(col1); create table b(col1, col2) select a.* from a inner join b using(col2) left join b.col2 as c on (c.col1 = a.col1) System notifies me that b is not a schema name. So, I guess

Re: [SQL] i need solution to this problem

2006-06-28 Thread Ragnar
On mið, 2006-06-28 at 11:15 +0530, Penchalaiah P. wrote: I have tables like 1) emp_table (personal_no integer (foreign key), cdacno varchar (primary key),name varchar); 2) Rank_table (rank_id varchar (primary key), rank_name varchar); 3) Rank_date_table (rank_id (foreign key), rank_date

Re: [SQL] is an explicit lock necessary?

2006-05-04 Thread Ragnar
On fim, 2006-05-04 at 11:10 -0700, Ash Grove wrote: Hi, Does beginning a transaction put locks on the tables queried within the transaction? In the example below, is #2 necessary? My thought was that I would need to use an explicit lock to make sure that the sequence value I'm selecting

Re: [SQL] Sequential scan where Index scan expected (update)

2006-03-03 Thread Ragnar
On fim, 2006-03-02 at 23:28 -0800, Bryce Nesbitt wrote: I'm getting sequential scans (and poor performance), on scans using my primary keys. This is an older postgres. Can anyone help figure out why? demo=# \d xx_thing Table public.xx_thing Column

Re: [SQL] Why do I get these results?????

2006-03-03 Thread Ragnar
On fös, 2006-03-03 at 09:50 +0100, Joost Kraaijeveld wrote: Hi, Why do I get the following result from the query below? I expected that, given the fact that there are over 100 Jansen (but no jansen) in Nijmegen the first record would definitively be people living in Nijmegen. If I change

Re: [SQL] Dump/restore comments only?

2006-02-27 Thread Ragnar
On mán, 2006-02-27 at 13:56 +1100, Bath, David wrote: There have been a number of times when I've wanted to ignore everything in a dump file apart from comments. I am interested not just in comments for tables/views/columns but constraints, indices and functions as well. Many of my

Re: [SQL] to count no of columns in a table

2006-02-16 Thread Ragnar
On fim, 2006-02-16 at 14:43 +0530, AKHILESH GUPTA wrote: i just want to know one thing that is there any function in PGSQL which gives me the total number of columns in a table. OR just like we are using count(*), it gives us total number or rows in a table, just like i want to know the total

Re: [SQL] CREATE INDEX with order clause

2006-02-03 Thread Ragnar
On Wed, 2006-02-01 at 10:46 -0500, Daniel Caune wrote: Hi, [snip need for reverse-sort operator class] SELECT GAME_CLIENT_VERSION FROM GSLOG_EVENT WHERE PLAYER_USERNAME = ? AND EVENT_NAME = ? AND EVENT_DATE_CREATED ? ORDER BY EVENT_DATE_CREATED DESC LIMIT 1

Re: [SQL] insert only if conditions are met?

2005-08-31 Thread Ragnar Hafstað
On Wed, 2005-08-31 at 11:49 -0400, Henry Ortega wrote: What I am trying to do is * Insert a record for EMPLOYEE A to TABLE A IF the sum of the hours worked by EMPLOYEE A on TABLE A is not equal to N Is this possible? Sure, given a suitable schema It is not clear to me, if the hours

Re: [SQL] insert only if conditions are met?

2005-08-31 Thread Ragnar Hafstað
On Wed, 2005-08-31 at 12:49 -0400, Henry Ortega wrote: Ok. Here's TABLE A empdate hours type JSMITH 08-15-2005 5 WORK JSMITH 08-15-2005 3 WORK JSMITH 08-25-2005 6 WORK I want to insert the ff: 1.)

Re: [SQL] how to use column name with Case-sensitive with out usig

2005-08-06 Thread Ragnar Hafstað
On Sat, 2005-08-06 at 05:00 +, wisan watcharinporn wrote: how can i use create table myName( myColumnName varchar(32) ); select myColumnName from myColumnName ; Assuming you meant 'from myName' here, this should work. On the other hand, this will NOT work: create table myName(

Re: [SQL] ids from grouped rows

2005-07-20 Thread Ragnar Hafstað
On Wed, 2005-07-20 at 08:46 -0400, Lindsay wrote: SELECT name, MAX(age), id_for_row_with_max_age FROM Person GROUP BY name how about: select distinct on (name) name, age, id from person order by name, age desc; gnari ---(end of

Re: [SQL] Does Postgresql have a similar pseudo-column ROWNUM as

2005-05-18 Thread Ragnar Hafstað
On Tue, 2005-05-17 at 23:16 -0300, Alain wrote: Ragnar Hafstað escreveu: [how to solve the get next 100 records problem] BUT, I think that this is close to a final solution, I made some preliminary test ok. Please tell me what you think about this. Fisrt let's state that I am reading

Re: [SQL] Changed to: how to solve the get next 100 records problem

2005-05-18 Thread Ragnar Hafstað
On Wed, 2005-05-18 at 12:42 -0300, Alain wrote: I found something that is both fast and simple (program side): ... subsequent selects are (select ... from tab WHERE skey=skey_last AND pkeypkey_last ORDER BY skey,pkey LIMIT 100) UNION (select ... from tab WHERE

Re: [SQL] Does Postgresql have a similar pseudo-column ROWNUM as

2005-05-17 Thread Ragnar Hafstað
On Tue, 2005-05-17 at 14:48 -0300, Alain wrote: Andrew Sullivan escreveu: On Thu, May 12, 2005 at 01:07:00PM -0600, [EMAIL PROTECTED] wrote: Does Postgresql have a similar pseudo-column ROWNUM as Oracle? If so, we can write the following query: No. What is the purpose of your

Re: [SQL] Does Postgresql have a similar pseudo-column ROWNUM as

2005-05-17 Thread Ragnar Hafstað
On Tue, 2005-05-17 at 15:43 -0300, Alain wrote: [how to solve the get next 100 records problem] I am assuming this is for a web like interface, in other words that cursors are not applicable [me] if you are ordering by a unique key, you can use the key value in a WHERE clause.

Re: [SQL] Does Postgresql have a similar pseudo-column ROWNUM as

2005-05-17 Thread Ragnar Hafstað
On Wed, 2005-05-18 at 00:13 +0200, PFC wrote: your subsequent selects are select ... from tab WHERE skeyskey_last OR (skey=skey_last AND pkeypkey_last) ORDER BY skey,pkey LIMIT 100 OFFSET 100; why offset ? you

Re: [SQL] ORDER BY handling mixed integer and varchar values

2005-05-16 Thread Ragnar Hafstað
On Mon, 2005-05-16 at 11:47 -0700, David B wrote: (sorting text columns numerically) And of course I get stuff ordered as I want it. BUT with many product categories being numeric based they come out in wrong order '10 comes before 2 etc. So I tried Select product_desc, product_price,

Re: [SQL] Replacing a table with constraints

2005-05-13 Thread Ragnar Hafstað
On Fri, 2005-05-13 at 14:38 -0400, Mark Fenbers wrote: I have a table called Counties which partially contains a lot bad data. By bad data, I mean some records are missing; some exist and shouldn't; and some records have fields with erroneous information. However, the majority of the data in

Re: [SQL] Trimming the cost of ORDER BY in a simple query

2005-05-03 Thread Ragnar Hafstað
On Mon, 2005-05-02 at 21:35 -0700, [EMAIL PROTECTED] wrote: Query (shows the last 7 dates): = SELECT DISTINCT date_part('year', uu.add_date), date_part('month', uu.add_date), date_part('day', uu.add_date) FROM user_url uu WHERE uu.user_id=1 ORDER BY date_part('year', uu.add_date)

Re: [SQL] can someone jelp me on this?

2005-05-01 Thread Ragnar Hafstað
On Tue, 2005-04-26 at 20:18 +, Lord Knight of the Black Rose wrote: hey guys I have a question that I couldnt maneged to solve for the last 4 days. Im kinda new to these stuff so dont have fun with me if it was so easy. Ok now heres the question. [snip class assignment] we'd all love

Re: [SQL] subselect query time and loops problem

2005-04-10 Thread Ragnar Hafstað
On Sun, 2005-04-10 at 07:54 -0700, pankaj naug wrote: [quoting Tom] Evidently one has been analyzed much more recently than the other, because the estimated row counts are wildly different. Both the explain/analyse queries has been run at the same time. in that case, is the data the same?

Re: [SQL] getting count for a specific querry

2005-04-08 Thread Ragnar Hafstað
On Fri, 2005-04-08 at 11:07 -0400, Andrew Sullivan wrote: On Fri, Apr 08, 2005 at 09:29:13AM -0400, Joel Fradkin wrote: Is there a fast way to get the count? Not really, no. You have to perform a count() to get it, which is possibly expensive. One way to do it, though, is to do

Re: [SQL] getting count for a specific querry

2005-04-08 Thread Ragnar Hafstað
On Fri, 2005-04-08 at 09:29 -0400, Joel Fradkin wrote: Our app currently pulls a bunch of data to several query pages. My idea is to use the limit and offset to return just the first 50 records, if they hit next I can set the offset. My understanding was this gets slower as you move

Re: [SQL] getting count for a specific querry

2005-04-08 Thread Ragnar Hafstað
On Fri, 2005-04-08 at 12:32 -0400, Tom Lane wrote: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= [EMAIL PROTECTED] writes: you might reduce the performance loss if your dataset is ordered by a UNIQUE index. select * from mytable where somecondition ORDER by uniquecol limit 50

Re: [SQL] 9.17.5. Row-wise Comparison

2005-04-07 Thread Ragnar Hafstað
On Thu, 2005-04-07 at 06:44 -0700, TJ O'Donnell wrote: it might break in future. if (b 1) then true else if (b = 1 and c 2) then true else if (b = 1 and c = 2 and d 3) then true else false Your spec sql snippet is like an OR, isn't it, instead of an AND as I'm

Re: [SQL] select group by

2005-04-04 Thread Ragnar Hafstað
On Mon, 2005-04-04 at 12:16 +0200, Michael L. Hostbaek wrote: I've got a problem selecting some specific data from my table. Imagine the following rows: part | mfg | qty | price | eta --- TEST1 ABC 10 100(No ETA, as item is

Re: [SQL] select group by

2005-04-04 Thread Ragnar Hafstað
On Mon, 2005-04-04 at 10:47 +, Ragnar Hafstað wrote: On Mon, 2005-04-04 at 12:16 +0200, Michael L. Hostbaek wrote: [problem] [slightly broken solution] I forgot a FROM clause, and you might want to add a ORDER BY clause, if that is important: select part,mfg, sum(CASE WHEN eta

Re: [SQL] A SQL Question About distinct, limit, group by, having,

2005-03-31 Thread Ragnar Hafstað
On Thu, 2005-03-31 at 13:14 +0800, Lin Kun Hsin wrote: below is the sql schema. i hope it will help. i want the top 3 score students in every class this has been discussed before. a quick google gives me: http://archives.postgresql.org/pgsql-sql/2004-04/msg00067.php gnari

Re: [SQL] Query performance problem

2005-03-17 Thread Ragnar Hafstað
On Fri, 2005-03-18 at 10:49 +0530, Kenneth Gonsalves wrote: On Thursday 17 Mar 2005 7:35 pm, Richard Huxton wrote: Not necessarily. NOT NULL here helps to ensure you can add values together without the risk of a null result. There are plenty of amount columns that should be not-null

Re: [SQL] Scheme not dropping

2005-03-15 Thread Ragnar Hafstað
On Tue, 2005-03-15 at 18:44 +, Graham Vickrage wrote: I am dropping a database with an additional scheme other than public on version 7.3.2. When I come to recreate the database with the same scheme it gives me the error: ERROR: namespace xxx already exists does the scheme exist in

Re: [SQL] How to cast VARCHAR to BYTEA and vice-versa?

2005-03-14 Thread Ragnar Hafstað
On Tue, 2005-03-08 at 07:31 -0800, Moran.Michael wrote: Hello all, I have a table with a VARCHAR column that I need to convert to a BYTEA. How do I cast VARCHAR to BYTEA? have you looked at the encode() and decode() functions ?

Re: [SQL] psql encoding problem

2005-03-02 Thread Ragnar Hafstað
On Mon, 2005-02-28 at 20:48 +, T E Schmitz wrote: INSERT INTO item (name,retail_price) VALUES ('Cheese Soufflé',7.95,); (I presume you see the accented character in *Soufflé*) psql comes back with invalid byte sequence for encoding UNICODE: 0xe9 If I do this via DbVisualizer, the

Re: [SQL] Serial and Index

2005-02-27 Thread Ragnar Hafstað
On Sun, 2005-02-27 at 12:54 +, Sam Adams wrote: I read at http://jamesthornton.com/postgres/FAQ/faq-english.html#4.15.1 that when a serial is created then an index is created on the column. However I can't seem to find this anywhere in the PoistgreSQL manual. Is this true? Thanks. no,

Re: [SQL] Read count ?

2005-02-26 Thread Ragnar Hafstað
On Thu, 2005-02-24 at 17:17 +0200, Aarni Ruuhimäki wrote: Hi, Could someone please give a hint on how to query the following neatly ? Get news from a news table that belong to a particular account, get segment name from segments table for each news item and read count from read history

Re: [SQL] pg primary key bug?

2005-02-22 Thread Ragnar Hafstað
On Tue, 2005-02-22 at 10:33 +0100, pginfo wrote: We are using jdbc (jdbc driver from pg) + jboss (java based application server) + connection pool (biult in jboss). ... Will vacuum full generate this problem if we have locked table in this time? (It is possible to have locked table in

Re: [SQL] schemas and paths with the alter statement

2005-02-22 Thread Ragnar Hafstað
On Tue, 2005-02-22 at 11:06 -0800, Theodore Petrosky wrote: I have to first admit that I am very green at this. I thought that one could refer to a table in a fully qualified path... public.testtable ... ALTER TABLE public.test ADD CONSTRAINT public.test_PK PRIMARY KEY (test); ...

Re: [SQL] Making NULL entries appear first when ORDER BY field

2005-02-15 Thread Ragnar Hafstað
On Wed, 2005-02-16 at 00:55 +, Andreas Joseph Krogh wrote: SELECT start_date, start_time, end_time, title FROM onp_crm_activity_log WHERE start_date IS NOT NULL ORDER BY start_date ASC, start_time ASC; start_date | start_time | end_time | title

Re: [PERFORM] [SQL] OFFSET impact on Performance???

2005-01-25 Thread Ragnar Hafstað
On Thu, 2005-01-20 at 11:59 -0500, Greg Stark wrote: The best way to do pages for is not to use offset or cursors but to use an index. This only works if you can enumerate all the sort orders the application might be using and can have an index on each of them. To do this the query would

Re: [PERFORM] [SQL] OFFSET impact on Performance???

2005-01-25 Thread Ragnar Hafstað
On Thu, 2005-01-20 at 19:12 +, Ragnar Hafstað wrote: On Thu, 2005-01-20 at 11:59 -0500, Greg Stark wrote: The best way to do pages for is not to use offset or cursors but to use an index. This only works if you can enumerate all the sort orders the application might be using and can