Re: [GENERAL] help with data recovery from injected UPDATE

2009-06-12 Thread Chris Spotts
It's a classic story.  I'm volunteering about one day per month for this project, learning SQL as I go.  Priority was always given to the get it working tasks and never the make it safe tasks.  I had/have grandiose plans to rewrite the whole system properly after I graduate.  

Re: [GENERAL] help with data recovery from injected UPDATE

2009-06-11 Thread Vick Khera
On Wed, Jun 10, 2009 at 12:49 PM, Gus Gutoskishared.entanglem...@gmail.com wrote: Of course, the double minus sign comments out the rest of the line and the statement is left dangling, looking for a terminating semicolon. SQL statements are not terminated with semi-colons. The semi-colon is

Re: [GENERAL] help with data recovery from injected UPDATE

2009-06-11 Thread Merlin Moncure
On Wed, Jun 10, 2009 at 12:49 PM, Gus Gutoskishared.entanglem...@gmail.com wrote: Hi, I'm a noob who failed to properly sanitize incoming data from the front end.  As a result, a poor hapless user managed to smuggle in a malicious UPDATE statement that corrupted every single record in a

Re: [GENERAL] help with data recovery from injected UPDATE

2009-06-11 Thread Gus Gutoski
Thanks for the replies. Tom Lane wrote: This being 8.1, if you haven't turned on autovacuum there is some chance of that. Unfortunately, autovacuum was on. I don't recall ever turning it on, but this database is over two years old; it's possible that I blindly followed advice from pgAdmin or

Re: [GENERAL] help with data recovery from injected UPDATE

2009-06-11 Thread Chris Spotts
It's a classic story. I'm volunteering about one day per month for this project, learning SQL as I go. Priority was always given to the get it working tasks and never the make it safe tasks. I had/have grandiose plans to rewrite the whole system properly after I graduate. Unfortunately,

Re: [GENERAL] help with data recovery from injected UPDATE

2009-06-11 Thread Scott Marlowe
On Thu, Jun 11, 2009 at 1:32 PM, Chris Spottsrfu...@gmail.com wrote: It's a classic story.  I'm volunteering about one day per month for this project, learning SQL as I go.  Priority was always given to the get it working tasks and never the make it safe tasks.  I had/have grandiose plans to

Re: [GENERAL] help with data recovery from injected UPDATE

2009-06-10 Thread Tom Lane
Gus Gutoski shared.entanglem...@gmail.com writes: Naturally then, *every* record in the database has its foreign_id field set to 2 and its coin field set to 50. I *really* need to recover that foreign_id field. (As its name suggests, that field is a foreign key into a different table.)

Re: [GENERAL] Help with join syntax sought supplemental

2009-05-21 Thread Alban Hertroys
On May 20, 2009, at 7:17 PM, James B. Byrne wrote: Looking at this I have to wonder what will be the effect of having tens of thousands of rate-pairs on file. Would this query be improved by first doing a sub-query on base/quote pairs that returned DISTINCT pairs and then do the IN condition

Re: [GENERAL] Help with join syntax sought supplemental

2009-05-21 Thread James B. Byrne
On Thu, May 21, 2009 06:02, Alban Hertroys wrote: But as people often say here, premature optimisation is a waste of time, so don't go that route unless you have a reason to expect problems in that area. That was my very thought when I sent that message. On the other hand, in case I was

Re: [GENERAL] Help with join syntax sought supplemental

2009-05-20 Thread Andy Colson
James B. Byrne wrote: On Wed, May 20, 2009 13:07, James B. Byrne wrote: This seems to be working. I had to take a different approach as I had misapprehended GROUP BY completely. SELECT * FROM currency_exchange_rates AS xchg1 WHERE id IN ( SELECT id FROM currency_exchange_rates as

Re: [GENERAL] Help with join syntax sought

2009-05-20 Thread Andy Colson
James B. Byrne wrote: On Tue, May 19, 2009 17:43, Andy Colson wrote: . What field is the source? currency_code_quote? -Andy Here is the layout of the table: # Table name: currency_exchange_rates # # id :integer not null, primary key # currency_code_base

Re: [GENERAL] Help with join syntax sought

2009-05-20 Thread James B. Byrne
This seems to be working. I had to take a different approach as I had misapprehended GROUP BY completely. SELECT * FROM currency_exchange_rates AS xchg1 WHERE id IN ( SELECT id FROM currency_exchange_rates as xchg2 WHERE xchg1.currency_code_base = xchg2.currency_code_base

Re: [GENERAL] Help with join syntax sought supplemental

2009-05-20 Thread James B. Byrne
On Wed, May 20, 2009 13:07, James B. Byrne wrote: This seems to be working. I had to take a different approach as I had misapprehended GROUP BY completely. SELECT * FROM currency_exchange_rates AS xchg1 WHERE id IN ( SELECT id FROM currency_exchange_rates as xchg2 WHERE

Re: [GENERAL] Help with join syntax sought

2009-05-20 Thread James B. Byrne
On Tue, May 19, 2009 17:43, Andy Colson wrote: . What field is the source? currency_code_quote? -Andy Here is the layout of the table: # Table name: currency_exchange_rates # # id :integer not null, primary key # currency_code_base :string(3) not

Re: [GENERAL] Help with join syntax sought

2009-05-20 Thread Harald Fuchs
In article 43639.216.185.71.24.1242834374.squir...@webmail.harte-lyne.ca, James B. Byrne byrn...@harte-lyne.ca writes: What I want to be able to do is to return the most recent rate for all unique rate-pairs, irrespective of type. I also have the requirement to return the 5 most recent rates

Re: [GENERAL] Help with join syntax sought

2009-05-19 Thread Andy Colson
James B. Byrne wrote: I am perplexed why I cannot select a column from the table without having to include it in the GROUP BY clause as well. Any help is welcomed. Group by is saying I want only one row returned for each distinct value in this column so a food table like this: name |

Re: [GENERAL] Help with join syntax sought

2009-05-19 Thread Andy Colson
James B. Byrne wrote: I have a requirement to select the effective exchange rate for a number of currencies as of a specific date and time. The rates may come from several sources for the same currency. For some currencies the rate may be set infrequently. I have come close to getting this to

Re: [GENERAL] Help with join syntax sought

2009-05-19 Thread James B. Byrne
On Tue, May 19, 2009 16:41, Andy Colson wrote: If your query above is getting you mostly what you want, just use it as a derived table. I lack the experience to understand what this means. If, as you suggest, I use a subquery as the expression to the main SELECT and for it I use the syntax

Re: [GENERAL] Help with join syntax sought

2009-05-19 Thread James B. Byrne
On Tue, May 19, 2009 17:02, Andy Colson wrote: so: select max(name), type from food group by type works cuz we only get one name (the max name) back for each type. or: select name, type from food group by type, name which in our example is kinda pointless, but still, give us the distinct

Re: [GENERAL] Help with join syntax sought

2009-05-19 Thread Andy Colson
James B. Byrne wrote: On Tue, May 19, 2009 16:41, Andy Colson wrote: If your query above is getting you mostly what you want, just use it as a derived table. I lack the experience to understand what this means. If, as you suggest, I use a subquery as the expression to the main SELECT and

Re: [GENERAL] Help with join syntax sought

2009-05-19 Thread Andy Colson
James B. Byrne wrote: On Tue, May 19, 2009 17:02, Andy Colson wrote: so: select max(name), type from food group by type works cuz we only get one name (the max name) back for each type. or: select name, type from food group by type, name which in our example is kinda pointless, but still,

Re: [GENERAL] Help with join syntax sought

2009-05-19 Thread Andy Colson
James B. Byrne wrote: I have a requirement to select the effective exchange rate for a number of currencies as of a specific date and time. The rates may come from several sources for the same currency. For some currencies the rate may be set infrequently. I have come close to getting this to

Re: [GENERAL] Help with join syntax sought

2009-05-19 Thread Andy Colson
Andy Colson wrote: James B. Byrne wrote: I have a requirement to select the effective exchange rate for a number of currencies as of a specific date and time. The rates may come from several sources for the same currency. For some currencies the rate may be set infrequently. I have come

Re: [GENERAL] Help with join syntax sought

2009-05-19 Thread Alban Hertroys
On May 19, 2009, at 11:29 PM, Andy Colson wrote: I'm not sure what this will do: HAVING COUNT(fxr.currency_code_quote) = 1 The only time I have ever used HAVING is like: select name from something group by name having count(*) 1 to find duplicate name's. That will leave out all

Re: [GENERAL] Help request to improve function performance

2009-04-25 Thread Seref Arikan
Hi Filip, Thanks a lot for your kind help. Selecting only once did the trick. Dropping to 2 seconds for select instead of 50 IS an improvement indeed :) Indexes on columns already existed, and just out of curiosity I've tested char columns instead of varchars, with no significant positive changes.

Re: [GENERAL] Help request to improve function performance

2009-04-23 Thread Seref Arikan
Hi Scott, I agree, and I am doing the entity attribute model because I simply have to. This table is used to persist data that is hold in user defined information models. Kind of a domain specific language. The users continously create these hierarchical structures, so neither the amount of them,

Re: [GENERAL] Help request to improve function performance

2009-04-23 Thread Filip Rembiałkowski
W dniu 22 kwietnia 2009 23:47 użytkownik Seref Arikan serefari...@kurumsalteknoloji.com napisał: Hi Filip, First of all: thanks a lot for your kind response. Here is the create script for my schema: CREATE TABLE app.archetype_data ( id BIGINT NOT NULL, context_id VARCHAR(1000),

Re: [GENERAL] Help request to improve function performance

2009-04-23 Thread Karsten Hilbert
On Wed, Apr 22, 2009 at 06:21:41PM -0600, Scott Marlowe wrote: CREATE TABLE app.archetype_data (   id BIGINT NOT NULL,   context_id VARCHAR(1000),   archetype_name VARCHAR(1000),   archetype_path VARCHAR(1000),   name VARCHAR(1000),   value_string VARCHAR(1000),   value_int

Re: [GENERAL] Help request to improve function performance

2009-04-23 Thread Karsten Hilbert
On Thu, Apr 23, 2009 at 09:44:53AM +0100, Seref Arikan wrote: I have worked with very capable DBAs before, and even though it has been quite some time since I've done real DB work, I would like to invest in postgresql as much as I can Seref, if you can muster the man power to build archetypes

Re: [GENERAL] Help request to improve function performance

2009-04-23 Thread Karsten Hilbert
On Thu, Apr 23, 2009 at 12:02:13AM +0100, Seref Arikan wrote: I have a set of dynamically composed objects represented in Java, with string values for various attributes, which have variable length. In case you have suggestions for a better type for this case, it would be my pleasure to hear

Re: [GENERAL] Help request to improve function performance

2009-04-22 Thread Filip Rembiałkowski
2009/4/22 sarikan serefari...@kurumsalteknoloji.com Dear members of the list, I have a function which returns a custom type, that has only two fields, each of them being varchar arrays. The reason that I have written this function is that I have a table basically with the following

Re: [GENERAL] Help request to improve function performance

2009-04-22 Thread Seref Arikan
Hi Filip, First of all: thanks a lot for your kind response. Here is the create script for my schema: CREATE TABLE app.archetype_data ( id BIGINT NOT NULL, context_id VARCHAR(1000), archetype_name VARCHAR(1000), archetype_path VARCHAR(1000), name VARCHAR(1000), value_string

Re: [GENERAL] Help request to improve function performance

2009-04-22 Thread Grzegorz Jaśkiewicz
you keep everything in varchars, and yet you request improvements in performance. you are a funny guy, ... -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Help request to improve function performance

2009-04-22 Thread Seref Arikan
Hi there, I have a set of dynamically composed objects represented in Java, with string values for various attributes, which have variable length. In case you have suggestions for a better type for this case, it would be my pleasure to hear about them. 2009/4/22 Grzegorz Jaśkiewicz

Re: [GENERAL] Help request to improve function performance

2009-04-22 Thread Scott Marlowe
2009/4/22 Seref Arikan serefari...@kurumsalteknoloji.com: Hi Filip, First of all: thanks a lot for your kind response. Here is the create script for my schema: CREATE TABLE app.archetype_data (   id BIGINT NOT NULL,   context_id VARCHAR(1000),   archetype_name VARCHAR(1000),  

Re: [GENERAL] Help request to improve function performance

2009-04-22 Thread John R Pierce
Seref Arikan wrote: I have a set of dynamically composed objects represented in Java, with string values for various attributes, which have variable length. In case you have suggestions for a better type for this case, it would be my pleasure to hear about them. cut out about 3 layers of

Re: [GENERAL] Help with C-Function on Postgre

2009-04-02 Thread Sam Mason
On Thu, Apr 02, 2009 at 12:52:40PM +0200, Angelo Nicolosi wrote: I wanted to write some C-Function Where is this code going to live? if it's going to be inside PG as a function you can call from SQL you want something called SPI: http://www.postgresql.org/docs/current/static/spi.html If it's

Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300

2008-10-29 Thread Brent Austin
brent1a$ From: Grzegorz Jaśkiewicz [EMAIL PROTECTED] To: Brent Austin [EMAIL PROTECTED] Cc: pgsql-general@postgresql.org Sent: Tuesday, October 28, 2008 8:23:31 AM Subject: Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300 just type

Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300

2008-10-29 Thread Albe Laurenz
Brent Austin wrote: Configure still failsI've tried everything I can figure [...] configure: error: pg_config not found (set PG_CONFIG environment variable) It's quite simple: - Find out where pg_config is. - If you don't have it, install the appropriate package. - Make sure it's in

Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300

2008-10-29 Thread Tom Lane
Brent Austin [EMAIL PROTECTED] writes: Configure still failsI've tried everything I can figure Last login: Wed Oct 29 02:58:10 on ttys000 client-6X-1XX-17-XX4:~ brent1a$ cd /psqlodbc-08.03.0300 client-6X-1XX-17-XX4:psqlodbc-08.03.0300 brent1a$ sudo ./configure Password: checking for

Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300

2008-10-29 Thread Brent Austin
) From: Albe Laurenz [EMAIL PROTECTED] To: Brent Austin *EXTERN* [EMAIL PROTECTED]; Grzegorz Jaśkiewicz [EMAIL PROTECTED] Cc: pgsql-general@postgresql.org Sent: Wednesday, October 29, 2008 7:14:37 AM Subject: Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300 Brent

Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300

2008-10-29 Thread Tom Lane
Brent Austin [EMAIL PROTECTED] writes: I could swear that is what I did..or is it not? That is why I sent a copy/paste of that mess from my terminal: it showed that I do have PG_CONFIG installed and it showed I did set my path. That is why I am asking help because configure is saying I

Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300

2008-10-28 Thread Grzegorz Jaśkiewicz
On Tue, Oct 28, 2008 at 12:22 PM, Brent Austin [EMAIL PROTECTED] wrote: Trying to install psqlodbc-08.03.0300 on Mac gets me this while I configure: client-6X-XXX-17-X14:~ brent1a$ cd /psqlodbc-08.03.0300 client-6X-XXX-17-X14:psqlodbc-08.03.0300 brent1a$ sudo ./configure checking for a

Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300

2008-10-28 Thread Brent Austin
: Tuesday, October 28, 2008 7:50:48 AM Subject: Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300 On Tue, Oct 28, 2008 at 12:22 PM, Brent Austin [EMAIL PROTECTED] wrote: Trying to install psqlodbc-08.03.0300 on Mac gets me this while I configure: client-6X-XXX-17-X14:~ brent1a$ cd

Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300

2008-10-28 Thread Grzegorz Jaśkiewicz
just type in 'pg_config' ,without quotes in terminal and see if it runs. if not, you gotta find it. For instance by using: find /usr -name pg_config than if it does come up with whereabouts of it - stick it into PG_CONFIG env variable: export PG_CONFIG=/path/path/pg_config and rerun configure in

Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300

2008-10-28 Thread John DeSoi
On Oct 28, 2008, at 8:22 AM, Brent Austin wrote: configure: error: pg_config not found (set PG_CONFIG environment variable) How did you do your PostgreSQL install? In the normal install from source, pg_config is in the bin folder with the rest of the usual PostgreSQL executables.

Re: [GENERAL] [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300

2008-10-28 Thread Albe Laurenz
Brent Austin wrote: Trying to install psqlodbc-08.03.0300 on Mac gets me this while I configure: client-6X-XXX-17-X14:~ brent1a$ cd /psqlodbc-08.03.0300 client-6X-XXX-17-X14:psqlodbc-08.03.0300 brent1a$ sudo ./configure checking for a BSD-compatible install... /usr/bin/install -c

Re: [GENERAL] Help with query to return indexes (including functional ones!) on a given table

2008-09-22 Thread Tom Lane
Philip Hallstrom [EMAIL PROTECTED] writes: I'm trying to add functional index support to Rails' Active Record and am getting stuck when it comes to a method Rails has to print out the indexes associated with a given table. The SQL being run is below: SELECT distinct i.relname,

Re: [GENERAL] Help with a foreign key with non-unique reference?

2008-09-16 Thread Stephan Szabo
On Tue, 16 Sep 2008, Brent Wood wrote: I need a foreign key (or equivalent) where the referenced table cannot have a unique constraint. Well, do you need a full foreign key or just the insert-time check on the referencing table? Does the referenced table get updates or deletes that you want to

Re: [GENERAL] Help Me !!!

2008-07-25 Thread Shane Ambler
[EMAIL PROTECTED] wrote: Hello boys, I have a problem are not practical for sql. I helped to find the 'error of this query? SELECT fresh.articoli.barcode, fresh.articoli.descrizione, fresh.articoli.grammatura, fresh.articoli.id_marchio, fresh.articoli.imballo,

Re: [GENERAL] Help Me !!!

2008-07-25 Thread Danyelle Gragsone
2008/7/24 [EMAIL PROTECTED]: Hello boys, I have a problem are not practical for sql. I helped to find the 'error of this query? SELECT fresh.articoli.barcode, fresh.articoli.descrizione, fresh.articoli.grammatura, fresh.articoli.id_marchio, fresh.articoli.imballo,

Re: [GENERAL] HELP with a query with blank fields

2008-06-01 Thread Stephan Szabo
On Tue, 27 May 2008, J. Manuel Velasco wrote: Hello, This is the current query I have: SELECT dominis.nom, dominis.extensio, dominis.creat, dominis.expira, titulars.first_name, titulars.last_name, contactes_admin_tec.first_name, contactes_admin_tec.last_name, dns1.nom, dns2.nom,

Re: [GENERAL] Help with remote connection to remote Postgresql 8.3 Server...

2008-05-29 Thread Dave Page
On Wed, May 28, 2008 at 10:17 PM, hobbes [EMAIL PROTECTED] wrote: Hi Guys, I have been trying to get my local (windows) machine's PgAdmin II to connect directly to a remote Linux (Debian) Server where Postgresql 8.3 is installed. Is that a typo? pgAdmin II hasn't been supported in years and

Re: [GENERAL] Help with remote connection to remote Postgresql 8.3 Server...

2008-05-29 Thread hobbes
On May 29, 4:45 pm, [EMAIL PROTECTED] (Dave Page) wrote: On Wed, May 28, 2008 at 10:17 PM, hobbes [EMAIL PROTECTED] wrote: Hi Guys, I have been trying to get my local (windows) machine's PgAdmin II to connect directly to a remote Linux (Debian) Server where Postgresql 8.3 is installed.

Re: [GENERAL] Help with remote connection to remote Postgresql 8.3 Server...

2008-05-28 Thread Tom Lane
hobbes [EMAIL PROTECTED] writes: I have been trying to get my local (windows) machine's PgAdmin II to connect directly to a remote Linux (Debian) Server where Postgresql 8.3 is installed. What exactly happens when you try? A reasonable guess is that you need to poke a hole in your firewall,

Re: [GENERAL] Help with remote connection to remote Postgresql 8.3 Server...

2008-05-28 Thread hobbes
On May 29, 5:17 am, hobbes [EMAIL PROTECTED] wrote: Hi Guys, I have been trying to get my local (windows) machine's PgAdmin II to connect directly to a remote Linux (Debian) Server where Postgresql 8.3 is installed. I have set in my postgresql.conf (remote): listen_addresses = '*'

Re: [GENERAL] help

2008-05-15 Thread Martijn van Oosterhout
On Tue, May 13, 2008 at 03:30:09PM +0530, Elizabeth George wrote: SET CLIENT_ENCODING TO 'UNICODE'; copy (select 1 as F1) to E'c:\\test.out' csv QUOTE AS E'\xFE' FORCE QUOTE F1; I got error like ERROR: invalid byte sequence for encoding UTF8: 0xfe HINT: This error can also happen if

Re: [GENERAL] Help! ERROR: could not open relation

2008-04-29 Thread Shane Ambler
Mircea Moisei wrote: I get this strange error Caused by: org.postgresql.util.PSQLException: ERROR: could not open relation 1663/53544/58374: No such file or directory How do I recover from it ? Postgresql version 8.2 on windows. Which update? 8.2.? - newer updates may have fixed the

Re: [GENERAL] help with plpgsql

2008-04-23 Thread A. Kretschmer
am Mon, dem 21.04.2008, um 17:46:49 +0200 mailte Pau Marc Munoz Torres folgendes: Hi everybody I trying to upload some plpsql functions to postgresql database using a perl script and i get the following error psql:/usr/local/Make2D-DB_II/pgsql/make2db_functions.pgsql:85: ERROR:

Re: [GENERAL] help with plpgsql

2008-04-21 Thread Pau Marc Munoz Torres
Hi everybody I trying to upload some plpsql functions to postgresql database using a perl script and i get the following error psql:/usr/local/Make2D-DB_II /pgsql/make2db_functions.pgsql:85: ERROR: language plpgsql does not exist HINT: Use CREATE LANGUAGE to load the language into the

Re: [GENERAL] help with plpgsql

2008-04-21 Thread Craig Ringer
Pau Marc Munoz Torres wrote: ERROR: language plpgsql already exists anybody knows what's wrong? Is there any chance you might be connecting to a different database with the perl script and with psql? Procedural languages must be installed into a particular database. -- Craig Ringer --

Re: [GENERAL] help with plpgsql

2008-04-21 Thread Christophe
On Apr 21, 2008, at 8:51 AM, Pau Marc Munoz Torres wrote: psql:/usr/local/Make2D-DB_II /pgsql/make2db_functions.pgsql:85: ERROR: language plpgsql does not exist HINT: Use CREATE LANGUAGE to load the language into the database. and then when I try to create the language, i get geldb=#

Re: [GENERAL] help with plpgsql

2008-04-21 Thread Shane Ambler
Pau Marc Munoz Torres wrote: Hi everybody I trying to upload some plpsql functions to postgresql database using a perl script and i get the following error psql:/usr/local/Make2D-DB_II /pgsql/make2db_functions.pgsql:85: ERROR: language plpgsql does not exist HINT: Use CREATE LANGUAGE to

Re: [GENERAL] HELP FOR LOADING a .psql file (same question again but explained neatly)

2008-02-28 Thread Richard Huxton
akshay bhat wrote: hello i am new to psql or any database stuff. i have downloaded an .psql file from internet and wish to open it and see the data inside. i am working on windows xp and have installed the software successfully. please help i am my wits end. So what have you tried so far? What

Re: [GENERAL] HELP FOR LOADING a .psql file (same question again but explained neatly)

2008-02-28 Thread Colin Wetherbee
akshay bhat wrote: hello i am new to psql or any database stuff. i have downloaded an .psql file from internet and wish to open it and see the data inside. i am working on windows xp and have installed the software successfully. please help i am my wits end. it is huge file 800mb and is

Re: [GENERAL] help for loading a psql file

2008-02-27 Thread Chris
akshay bhat wrote: hello i am new to psql or any database stuff. i have downloaded an .psql file from internet and wish to open it and see the data inside. Drag it into your text editor. -- Postgresql php tutorials http://www.designmagick.com/ ---(end of

Re: [GENERAL] HELP FOR LOADING a .psql file (same question again but explained neatly)

2008-02-27 Thread Ranbeer Makin
On the postgres command prompt you can use /i filename ... try if it works Cheers On Thu, Feb 28, 2008 at 9:07 AM, akshay bhat [EMAIL PROTECTED] wrote: hello i am new to psql or any database stuff. i have downloaded an .psql file from internet and wish to open it and see the data

Re: [GENERAL] help optimizing query

2008-02-09 Thread Adam Rich
It seems to do the job, but how good is it in the long run? Any way I could tweak it? I think this form will work the best: SELECT u.login, MAX(s.stop_time) AS last_use_time FROM users u, stats s WHERE u.id=s.user_id AND u.status='3' AND u.next_plan_id IS NULL GROUP BY u.login HAVING

Re: [GENERAL] help optimizing query

2008-02-09 Thread Scott Marlowe
On Feb 9, 2008 8:04 PM, Adam Rich [EMAIL PROTECTED] wrote: It seems to do the job, but how good is it in the long run? Any way I could tweak it? I think this form will work the best: SELECT u.login, MAX(s.stop_time) AS last_use_time FROM users u, stats s WHERE u.id=s.user_id AND

Re: [GENERAL] Help with pre-loaded arbitrary key sequences

2008-01-17 Thread James B. Byrne
On Thu, January 17, 2008 10:15, Scott Marlowe wrote: If race conditions are a possible issue, you use a sequence and increment that until you get a number that isn't used. That way two clients connecting at the same time can get different, available numbers. That is close to the idea that

Re: [GENERAL] Help with pre-loaded arbitrary key sequences

2008-01-17 Thread Scott Marlowe
On Jan 17, 2008 9:05 AM, James B. Byrne [EMAIL PROTECTED] wrote: If the entries involved numbered in the millions then Scott's approach has considerable merit. In my case, as the rate of additions is very low and the size of the existing blocks is in the hundreds rather than hundreds of

Re: [GENERAL] Help with pre-loaded arbitrary key sequences

2008-01-17 Thread James B. Byrne
On Wed, January 16, 2008 18:40, Scott Marlowe wrote: You're essentially wanting to fill in the blanks here. If you need good performance, then what you'll need to do is to preallocate all the numbers that haven't been assigned somewhere. So, we make a table something like: create table

Re: [GENERAL] Help with pre-loaded arbitrary key sequences

2008-01-17 Thread Scott Marlowe
On Jan 17, 2008 9:19 AM, James B. Byrne [EMAIL PROTECTED] wrote: On Thu, January 17, 2008 10:15, Scott Marlowe wrote: If race conditions are a possible issue, you use a sequence and increment that until you get a number that isn't used. That way two clients connecting at the same time

Re: [GENERAL] Help with pre-loaded arbitrary key sequences

2008-01-17 Thread Scott Marlowe
On Jan 17, 2008 9:19 AM, James B. Byrne [EMAIL PROTECTED] wrote: On Thu, January 17, 2008 10:15, Scott Marlowe wrote: If race conditions are a possible issue, you use a sequence and increment that until you get a number that isn't used. That way two clients connecting at the same time

Re: [GENERAL] Help with pre-loaded arbitrary key sequences

2008-01-17 Thread James B. Byrne
On Thu, January 17, 2008 11:48, Scott Marlowe wrote: Got bored, hacked this aggregious pl/pgsql routine up. It looks horrible, but I wanted it to be able to use indexes. Seems to work. Test has ~750k rows and returns in it and returns a new id in 1ms on my little server. File attached.

Re: [GENERAL] Help with pre-loaded arbitrary key sequences

2008-01-16 Thread Martijn van Oosterhout
On Fri, Jan 11, 2008 at 11:43:54AM -0500, James B. Byrne wrote: My question is this: Can one assign an id number to a sequenced key column on create and override the sequencer? If one does this then can and, if so, how does the sequencer in Postgresql handle the eventuality of running into a

Re: [GENERAL] Help with pre-loaded arbitrary key sequences

2008-01-16 Thread Scott Marlowe
On Jan 11, 2008 10:43 AM, James B. Byrne [EMAIL PROTECTED] wrote: I am prototyping a system migration that is to employ Ruby, Rails and PostgreSQL. Rails has the convention that the primary key of a row is an arbitrary integer value assigned by the database manager through a sequence. As it

Re: [GENERAL] Help needed optimizing query

2007-11-29 Thread Martijn van Oosterhout
On Thu, Nov 29, 2007 at 01:26:00PM +, Pedro Doria Meunier wrote: Hi People. I need some help optimizing this query: snip I still get Seq Scans although all used fields are indexed, hence the time used... :-( A seq scan on a table with 10 rows is *good*. An index would take longer. What

Re: [GENERAL] Help tuning a large table off disk and into RAM

2007-09-26 Thread Bill Moran
In response to James Williams [EMAIL PROTECTED]: I'm stuck trying to tune a big-ish postgres db and wondering if anyone has any pointers. I cannot get Postgres to make good use of plenty of available RAM and stop thrashing the disks. One main table. ~30 million rows, 20 columns all

Re: [GENERAL] Help tuning a large table off disk and into RAM

2007-09-26 Thread Alban Hertroys
James Williams wrote: The box has 4 x Opterons, 4Gb RAM five 15k rpm disks, RAID 5. We wanted fast query/lookup. We know we can get fast disk IO. RAID 5 is usually adviced against here. It's not particularly fast or safe, IIRC. Try searching the ML archives for RAID 5 ;) -- Alban Hertroys

Re: [GENERAL] Help tuning a large table off disk and into RAM

2007-09-26 Thread Jimmy Choi
:24 AM To: James Williams Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Help tuning a large table off disk and into RAM In response to James Williams [EMAIL PROTECTED]: I'm stuck trying to tune a big-ish postgres db and wondering if anyone has any pointers. I cannot get Postgres

Re: [GENERAL] Help tuning a large table off disk and into RAM

2007-09-26 Thread Tom Lane
Bill Moran [EMAIL PROTECTED] writes: Give it enough shared_buffers and it will do that. You're estimating the size of your table @ 3G (try a pg_relation_size() on it to get an actual size) If you really want to get _all_ of it in all the time, you're probably going to need to add RAM to the

Re: [GENERAL] Help tuning a large table off disk and into RAM

2007-09-26 Thread Scott Marlowe
On 9/26/07, James Williams [EMAIL PROTECTED] wrote: The last is based mostly on the observation that another tiddly unrelated mysql db which normally runs fast, grinds to a halt when we're querying the postgres db (and cpu, memory appear to have spare capacity). Just a quick observation

Re: [GENERAL] help w/ SRF function

2007-09-23 Thread Ow Mun Heng
On Tue, 2007-09-18 at 02:24 -0700, Trevor Talbot wrote: On 9/17/07, Ow Mun Heng [EMAIL PROTECTED] wrote: CREATE OR REPLACE FUNCTION foo_func(fromdate timestamp, todate timestamp, code text) LANGUAGE 'sql' IMMUTABLE STRICT; But If I were to use ALIASINg, I get an error

Re: [GENERAL] help w/ SRF function

2007-09-19 Thread A. Kretschmer
am Mon, dem 17.09.2007, um 9:21:22 +0800 mailte Ow Mun Heng folgendes: CREATE OR REPLACE FUNCTION foo_func(fromdate timestamp, todate timestamp, code text) RETURNS SETOF foo AS $BODY$ SELECT TRH.ID, TRH.data1, TRH.data2, FROM D INNER JOIN TS

Re: [GENERAL] help w/ SRF function

2007-09-19 Thread Ow Mun Heng
On Wed, 2007-09-19 at 07:57 +0200, A. Kretschmer wrote: am Mon, dem 17.09.2007, um 9:21:22 +0800 mailte Ow Mun Heng folgendes: CREATE OR REPLACE FUNCTION foo_func(fromdate timestamp, todate timestamp, code text) RETURNS SETOF foo AS $BODY$ SELECT TRH.ID, TRH.data1,

Re: [GENERAL] help w/ SRF function

2007-09-18 Thread Ow Mun Heng
On Mon, 2007-09-17 at 09:42 +0800, Ow Mun Heng wrote: On Mon, 2007-09-17 at 09:21 +0800, Ow Mun Heng wrote: Hi, I want to use a SRF to return multi rows. current SRF is pretty static. create type foo_type as ( id smallint data1 int data2 int ) CREATE OR REPLACE

Re: [GENERAL] help w/ SRF function

2007-09-18 Thread Trevor Talbot
On 9/17/07, Ow Mun Heng [EMAIL PROTECTED] wrote: CREATE OR REPLACE FUNCTION foo_func(fromdate timestamp, todate timestamp, code text) LANGUAGE 'sql' IMMUTABLE STRICT; But If I were to use ALIASINg, I get an error eg: DECLARE DECLARE fromdate ALIAS for $1; todate

Re: [GENERAL] help w/ SRF function

2007-09-16 Thread Ow Mun Heng
On Mon, 2007-09-17 at 09:21 +0800, Ow Mun Heng wrote: Hi, I want to use a SRF to return multi rows. current SRF is pretty static. create type foo_type as ( id smallint data1 int data2 int ) CREATE OR REPLACE FUNCTION foo_func() RETURNS SETOF foo AS $BODY$ SELECT

Re: [GENERAL] Help with this query (some join stuff I think)

2007-08-20 Thread Albe Laurenz
Pat Maddox wrote: I've got a bunch of companies that are associated with several videos. The videos have different statuses. I want to select all the companies in the database, and order them by videos that have a complete status. Here's what I have so far SELECT companies.id,

Re: [GENERAL] Help creating a function

2007-08-20 Thread A. Kretschmer
am Wed, dem 15.08.2007, um 17:29:17 -0400 mailte Madison Kelly folgendes: What I would like to do is create a function that would do the same thing so I could read out the IP addresses as standard dotted-decimal format. Could anyone help me with this? I am quite the n00b when it comes to

Re: [GENERAL] Help with this query (some join stuff I think)

2007-08-20 Thread Carlos Ortíz
? Try some thing like ths: SELECT companies.id, companies.name, companies.nickname, (Select count(*) from videos where companies.id=videos.company_id and videos.status= 'complete') num_videos FROM companies ORDER BY num_videos DESC Hope this help Carlos E. Ortiz

Re: [GENERAL] Help creating a function

2007-08-17 Thread Steve Atkins
On Aug 16, 2007, at 9:35 AM, Madison Kelly wrote: Note: This is being sent again (in case it shows up later). It never seemed to have made it to the list. Hi all, I'm using ulogd with PostgreSQL which stores IP addresses as 32bit unsigned integers. So when I select some data I get

Re: [GENERAL] Help to solve configure error

2007-08-04 Thread Tom Lane
Rajaram J [EMAIL PROTECTED] writes: I have a HP-UX server and have downloaded the code for postgresql to compile and use the libraries. Do you have the real C compiler, or the toy one that HP gives people who don't fork over extra money for the real one? Testing with the bundled compiler here,

Re: [GENERAL] Help with date math

2007-07-21 Thread Reid Thompson
Chris Hoover wrote: I need some help. I am trying to replicate a function from Sybase ASA, and am having difficulty. I need to be able to subtract 2 date (or timestamps) and return the results expressed in days, weeks, month, quarters, or years. How do I do this? I believe Postgres is

Re: [GENERAL] Help with date math

2007-07-21 Thread Reid Thompson
Chris Hoover wrote: I need some help. I am trying to replicate a function from Sybase ASA, and am having difficulty. I need to be able to subtract 2 date (or timestamps) and return the results expressed in days, weeks, month, quarters, or years. How do I do this? I believe Postgres is

Re: [GENERAL] help with tsearch2 stem compile

2007-07-21 Thread Oleg Bartunov
try patch from http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/ which updates snowball api Oleg On Tue, 17 Jul 2007, marcelo Cortez wrote: hi all i'm using postgresql 8.2.4 and install tsearch2 , but i need spanish idiom. following

Re: [GENERAL] Help with date math

2007-07-21 Thread Ragnar
On fös, 2007-07-20 at 11:08 -0400, Chris Hoover wrote: I need some help. I am trying to replicate a function from Sybase ASA, and am having difficulty. I need to be able to subtract 2 date (or timestamps) and return the results expressed in days, weeks, month, quarters, or years. How do I

Re: [GENERAL] help with libpq program

2007-06-18 Thread Dann Corbit
Where is your actual copy statement? What is your field delimiter? Why not post the actual C code for your program, if it is not too long? I guess from what you have posted that the delimiter you supplied does not match the delimiter from your copy statement. -Original Message- From:

Re: [GENERAL] help with libpq program

2007-06-18 Thread marcelo Cortez
DAnn My c code is one layer for wrap libpq.dll functions i'm using function like start with PGresult *PQexec(PGconn *conn, const char *command); command like 'copy foo from stdin '; int PQputCopyData(PGconn *conn, const char *buffer, int nbytes);

<    1   2   3   4   5   6   7   8   9   >