Re: [GENERAL] Help with converting hexadecimal to decimal

2005-04-01 Thread Dawid Kuroczko
On 31 Mar 2005 21:22:12 -0600, Doug Quale <[EMAIL PROTECTED]> wrote: > > > I basically want to convert a a hexadecimal to a decimal. > > Sure: > > > > test=> SELECT x'10'::integer; > >int4 > > -- > > 16 > > (1 row) Oh, some time ago I was looking for such a f

Re: [GENERAL] Help with case in select

2005-03-31 Thread Richard Huxton
Cristian Prieto wrote: Hello, I have the following sp, I need to return a 'Flag' if the ID of the row is in the prior select, I tryed with the following code: create or replace function sp_getadvertisers(ag integer) returns record as $main$ declare alladv record; retrec record; begin -- Primero b

Re: [GENERAL] Help with converting hexadecimal to decimal

2005-03-31 Thread Doug Quale
Bruce Momjian writes: > Chandra Sekhar Surapaneni wrote: > > Hi All, > > Is there a built in function which works exactly the opposite way as > > to_hex(). > > I basically want to convert a a hexadecimal to a decimal. > > Sure: > > test=> SELECT x'10'::integer; >int4 >

Re: [GENERAL] Help with converting hexadecimal to decimal

2005-03-31 Thread Bruce Momjian
Chandra Sekhar Surapaneni wrote: > Hi All, > Is there a built in function which works exactly the opposite way as > to_hex(). > I basically want to convert a a hexadecimal to a decimal. Sure: test=> SELECT x'10'::integer; int4 -- 16 (1 r

Re: [GENERAL] help w/ a little naive brainstorming ...

2005-03-26 Thread John DeSoi
On Mar 25, 2005, at 6:16 PM, OpenMacNews wrote: if i were to consider 'storing' those messages trees, instead, in a pgsql db, i i mmediately/naively think of three possible options (a) simple DB-stored references to flat file:/// locations (b) pointers to external, actionable (parseable? writeabl

Re: [GENERAL] help w/ a little naive brainstorming ...

2005-03-25 Thread OpenMacNews
hi michael, (1) does pgsql have/plan an equivalent of Oracle's External Tables? "The External Table feature allows for flat files, which reside outside the database, to be accessed just like relational tables within the datab

Re: [GENERAL] help w/ a little naive brainstorming ...

2005-03-25 Thread Michael Fuhr
On Fri, Mar 25, 2005 at 03:16:12PM -0800, OpenMacNews wrote: > (1) does pgsql have/plan an equivalent of Oracle's External Tables? > "The External Table feature allows for flat files, which reside outside the database, to b

Re: [GENERAL] Help with transactions

2005-03-22 Thread Michael Fuhr
On Mon, Mar 21, 2005 at 10:58:27AM -0500, Stephen Howie wrote: > I've notice a couple things. I ran a couple test and at first I > couldn't duplicate my error on some test tables. But I then added > inheritance to one of the tables and thats when I got the error again. Are you aware that fo

Re: [GENERAL] Help with transactions

2005-03-21 Thread Stephen Howie
Thanks for the reply. I've notice a couple things. I ran a couple test and at first I couldn't duplicate my error on some test tables. But I then added inheritance to one of the tables and thats when I got the error again. It looks like there is an error when obtaining the seq id (nextval) fr

Re: [GENERAL] Help with transactions

2005-03-18 Thread Michael Fuhr
On Fri, Mar 18, 2005 at 09:22:52AM -0500, Stephen Howie wrote: > I have a java program that excepts print streams and inserts in into a > spool table as a bytea. This fires a pl/pgsql trigger that passes the > bytea to a pl/perl function to process the bytea and spits the results > as an array

Re: [GENERAL] help with plpgsql function called by trigger

2005-03-17 Thread Heather Johnson
Thank you! That *is* nicer. And thanks to Michael Fuhr too for his reference to the appropriate docs and suggestions. Between your two responses, I have a much better sense of how to go about this and where to look for extra help. Heather Alban Hertroys wrote: Heather Johnson wrote: Hello-- I n

Re: [GENERAL] help with plpgsql function called by trigger

2005-03-17 Thread Alban Hertroys
Heather Johnson wrote: Hello-- I need to make sure that every time a row is inserted into a table called "users" rows are automatically inserted into two other tables: "join_bd" and "behavior_demographics". The inserts on join_bd and behavior_demographics need to create rows that are keyed to th

Re: [GENERAL] help with plpgsql function called by trigger

2005-03-16 Thread Michael Fuhr
On Wed, Mar 16, 2005 at 02:34:48PM -0500, Heather Johnson wrote: > CREATE FUNCTION insert_bd_join_bd (integer) RETURNS opaque AS ' What version of PostgreSQL are you using? The "opaque" type has been deprecated since 7.3; recent versions should use "trigger". And trigger functions aren't declare

Re: [GENERAL] Help with queries...

2005-02-24 Thread Tom Lane
"Cristian Prieto" <[EMAIL PROTECTED]> writes: > The book says: > [snip] > But my table name Grupos is not a reserved keyword, so SELECT * FROM Grupos; > should work, right??? but guess what... It doesn't work too... I need to > pass SELECT * FROM "Grupos"; You didn't read far enough: Quoti

Re: [GENERAL] Help with queries...

2005-02-24 Thread Joshua D. Drake
- Original Message - From: "Michael Fuhr" <[EMAIL PROTECTED]> To: "Cristian Prieto" <[EMAIL PROTECTED]> Cc: Sent: Thursday, February 24, 2005 2:44 PM Subject: Re: [GENERAL] Help with queries... On Thu, Feb 24, 2005 at 02:33:28PM -0600, Cristian Prieto wrot

Re: [GENERAL] Help with queries...

2005-02-24 Thread Cristian Prieto
PROTECTED]> To: "Cristian Prieto" <[EMAIL PROTECTED]> Cc: Sent: Thursday, February 24, 2005 2:44 PM Subject: Re: [GENERAL] Help with queries... On Thu, Feb 24, 2005 at 02:33:28PM -0600, Cristian Prieto wrote: select * from users; ERROR: relation "users" does not exist

Re: [GENERAL] Help with queries...

2005-02-24 Thread Michael Fuhr
On Thu, Feb 24, 2005 at 02:33:28PM -0600, Cristian Prieto wrote: > select * from users; > ERROR: relation "users" does not exist > > but: > select * from "Users"; > returns all the data I want... See "Identifiers and Keywords" in the "SQL Syntax" chapter of the documentation, especially the par

Re: [GENERAL] Help with queries...

2005-02-24 Thread Joshua D. Drake
Cristian Prieto wrote: Why do I need to add "" to a table when doing a query? I've checked the examples and I found no one has " around the table names. It is something with the configuration? If I do: select * from users; ERROR: relation "users" does not exist but: select * from "Users"; re

Re: [GENERAL] Help with tools...

2005-02-24 Thread Cristian Prieto
to" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, February 23, 2005 11:16 PM Subject: Re: [GENERAL] Help with tools... "Cristian Prieto" <[EMAIL PROTECTED]> writes: I've tryied with some tools as pgEditor and EMS PostgreSQL Manager, but I need a really good pgsql and data

Re: [GENERAL] Help with tools...

2005-02-23 Thread Jason Earl
"Cristian Prieto" <[EMAIL PROTECTED]> writes: > I've tryied with some tools as pgEditor and EMS PostgreSQL Manager, > but I need a really good pgsql and database Editor to use in Linux > or Windows. Options? Have you take a look at pgAdmin III? http://www.pgadmin.org/ What sort of features are

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Pavel Stehule
On Wed, 23 Feb 2005, Cristian Prieto wrote: > RETURNS SETOF Users gave me: > > getuser > - > (cristian,hola) > Yes, it's ok, but for SETOF function You have to use different style of calling SELECT * FROM getuser(...). If function call in normal centext then SRF function

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Cristian Prieto
RETURNS SETOF Users gave me: getuser - (cristian,hola) - Original Message - From: "Richard Huxton" To: "Pavel Stehule" <[EMAIL PROTECTED]> Cc: "Cristian Prieto" <[EMAIL PROTECTED]>; Sent: Wednesday, February 23, 2005 10:34

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Richard Huxton
Pavel Stehule wrote: If I did the following: SELECT * FROM "Users"; I get: userid | passwd --+ cristian | hola AND I execute: SELECT getuser('cristian', 'hola'); I get: getuser - (cristian,hola) There are two posibilities SELECT getuser('cristian','hola'); SELEC

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Pavel Stehule
> > If I did the following: > SELECT * FROM "Users"; > I get: > > userid | passwd > --+ > cristian | hola > > AND I execute: > SELECT getuser('cristian', 'hola'); > > I get: > getuser > - > (cristian,hola) > There are two posibilities SELECT getuser('cr

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Cristian Prieto
ot;Users" but inside a SP, how could I do it? - Original Message - From: "Jan Poslusny" To: "Cristian Prieto" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, February 23, 2005 8:36 AM Subject: Re: [GENERAL] Help with a very newbie question... 1. Plpgsql-function can retu

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Jan Poslusny
hanks a lot for your help... - Original Message - From: "Jan Poslusny" To: "Cristian Prieto" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, February 23, 2005 6:44 AM Subject: Re: [GENERAL] Help with a very newbie question... I think that sql-functions m

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Cristian Prieto
pgsql function? 3. If the record value is not a right return value, what kind of return value could I use for it? Thanks a lot for your help... - Original Message - From: "Jan Poslusny" To: "Cristian Prieto" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, February 23, 200

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Jan Poslusny
I think that sql-functions may serve as parametrized views for you... http://www.postgresql.org/docs/8.0/static/xfunc-sql.html Cristian Prieto wrote: I want to create a view or a sp which returns NULL if nothing is found and a recordset if the user is found I wrote something like: CREATE sp_ge

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Sean Davis
On Feb 23, 2005, at 6:14 AM, Andre Schnoor wrote: CREATE sp_getuser(name, pass) RETURNS record AS $body$ DECLARE retval RECORD; BEGIN SELECT INTO retval * FROM Users WHERE userid=name AND passwd=pass; IF NOT FOUND THEN RETURN NULL; ELSE RETURN retval; END; $body$ LAN

Re: [GENERAL] Help with a very newbie question...

2005-02-23 Thread Andre Schnoor
>>> I wrote something like: CREATE sp_getuser(name, pass) RETURNS record AS $body$ DECLARE retval RECORD; BEGIN SELECT INTO retval * FROM Users WHERE userid=name AND passwd=pass; IF NOT FOUND THEN RETURN NULL; ELSE RETURN retval; END; $body$ LANGUAGE plpgsql; What

Re: [GENERAL] Help with seq numbers...

2005-02-14 Thread javier wilson
On Mon, 14 Feb 2005 15:47:06 -0600, Cristian Prieto <[EMAIL PROTECTED]> wrote: > > why don't you use a serial? that way you don't have to insert it? i > > usually let postgresql take care of it, and you can use currval to > > return a value. > > That's the trouble, I need a sp that returns the use

Re: [GENERAL] Help with seq numbers...

2005-02-14 Thread Bruno Wolff III
On Mon, Feb 14, 2005 at 15:12:56 -0600, Cristian Prieto <[EMAIL PROTECTED]> wrote: > > And it is working fine, but when I get a Unique_Violation (cuz there is a > iduser already) the sequence still advance to the next value. There is any > way to rollback or avoid holes in the sequence? I've r

Re: [GENERAL] Help with seq numbers...

2005-02-14 Thread Thomas F . O'Connell
The manual is correct. There is no way to roll back a nextval. There are a variety of workarounds suggested in the archives. Take a look. One example is precalculating a large sequence and storing it in a table. -tfo -- Thomas F. O'Connell Co-Founder, Information Architect Sitening, LLC htt

Re: [GENERAL] Help with sorting (ie. ORDER BY expression)

2005-02-08 Thread Berend Tober
> This can be easily done with pl/pgsql, visit the documentation at > http://www.postgresql.org/docs/7.3/interactive/programmer-pl.html > OT: seems like this is a questionnaire/survey application, yes? > - - > Jonel Rienton FWIW, given the signature: "Reuben D. Budiardja, Dept. Physics and As

Re: [GENERAL] Help with sorting (ie. ORDER BY expression)

2005-02-07 Thread Jonel Rienton
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, This can be easily done with pl/pgsql, visit the documentation at http://www.postgresql.org/docs/7.3/interactive/programmer-pl.html OT: seems like this is a questionnaire/survey application, yes? - - Jonel Rienton http://blogs.road14.com

Re: [GENERAL] Help with strange join

2005-02-07 Thread Mike Rylander
On Mon, 7 Feb 2005 12:34:39 +0100, Victor SpÃng Arthursson <[EMAIL PROTECTED]> wrote: > > 2005-02-04 kl. 20.36 skrev Mike Rylander: > > > How about: > > > > SELECT r.* FROM opskrifter r JOIN opskrifter_content c ON (r.nummer = > > c.opskrift) JOIN opskrifter_ingredienser i ON (c.ingrediens = i.id

Re: [GENERAL] Help with strange join

2005-02-07 Thread Victor Spång Arthursson
2005-02-04 kl. 20.36 skrev Mike Rylander: How about: SELECT r.* FROM opskrifter r JOIN opskrifter_content c ON (r.nummer = c.opskrift) JOIN opskrifter_ingredienser i ON (c.ingrediens = i.id) WHERE EXISTS ( SELECT l.relid FROM languages l WHERE l.relid = i.betegnelse GROUP BY l.relid HAVING COUNT(D

Re: [GENERAL] Help with access check

2005-02-06 Thread Thomas Hallgren
Alvaro Herrera wrote: On Sun, Feb 06, 2005 at 03:28:31PM +0100, Thomas Hallgren wrote: Hi, From code inside a C-function, given the AclId of a user and the Oid of a Schema, what's the most efficient way to find out if the user has been granted CREATE on the schema? See src/backend/catalog

Re: [GENERAL] Help with access check

2005-02-06 Thread Alvaro Herrera
On Sun, Feb 06, 2005 at 03:28:31PM +0100, Thomas Hallgren wrote: Hi, > From code inside a C-function, given the AclId of a user and the Oid of > a Schema, what's the most efficient way to find out if the user has been > granted CREATE on the schema? See src/backend/catalog/aclchk.c, function p

Re: [GENERAL] Help with sorting (ie. ORDER BY expression)

2005-02-06 Thread Bruno Wolff III
On Sat, Feb 05, 2005 at 17:25:06 -0500, "Reuben D. Budiardja" <[EMAIL PROTECTED]> wrote: > > Hello, > I am running postgres-7.3. I have a query like this: > > SELECT question_id, question_text > FROM quiz_table > WHERE question_id IN (2,10,3,6,4,5); > > But I want the output to be sorted in th

Re: [GENERAL] Help with sorting (ie. ORDER BY expression)

2005-02-05 Thread Jonel Rienton
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, This can be easily done with pl/pgsql, visit the documentation at http://www.postgresql.org/docs/7.3/interactive/programmer-pl.html OT: seems like this is a questionnaire/survey application, yes? - - Jonel Rienton http://blogs.road14.com So

Re: [GENERAL] Help with strange join

2005-02-04 Thread Mike Rylander
On Fri, 4 Feb 2005 17:52:45 +0100, Victor SpÃng Arthursson <[EMAIL PROTECTED]> wrote: > > 2005-02-04 kl. 13.00 skrev Mike Rylander: > > > Can you send the table structure and the query that does this? It may > > just be a matter of adding a subselect with a HAVING clause, but we > > won't know u

Re: [GENERAL] Help with strange join

2005-02-04 Thread Victor Spång Arthursson
2005-02-04 kl. 13.00 skrev Mike Rylander: Can you send the table structure and the query that does this? It may just be a matter of adding a subselect with a HAVING clause, but we won't know until we have more information. Sure - coming up! First table is the main receipt table: tostipippitest=# s

Re: [GENERAL] Help with strange join

2005-02-04 Thread Alban Hertroys
Victor Spång Arthursson wrote: The tables are link according to the following: receipts <- related_ingredients <- ingredients <- languages If I just do JOINs, I will not be able to find out if only one or all of the ingredients are translated. What I need is something that, for example, returns

Re: [GENERAL] Help with strange join

2005-02-04 Thread Mike Rylander
On Fri, 4 Feb 2005 09:44:15 +0100, Victor SpÃng Arthursson <[EMAIL PROTECTED]> wrote: > God morning, everybody! > > I have a problem that I don't seem to be able to solve by my self, > thats why I kindly ask the list nowâ > > I have a database containing some tables, containing different receipts

Re: [GENERAL] help with a stored procedure

2005-01-03 Thread Michael Fuhr
On Mon, Jan 03, 2005 at 08:29:18AM -0600, Jason Tesser wrote: > I am new to postgres stored procedures and would like a little help. My > function basically takes 2 arguments and inserts data into a table from > a select statement. I want it to return the number of records inserted. See "Obtain

Re: [GENERAL] Help needed with QueryPlan

2004-12-16 Thread Alex
Richard, thanks for the reply. I actually did what you suggested but still the same. Now i set ENABLE_SEQSCAN=false in the perl script which works but I dont think thats the way it shold be done. Alex Richard Huxton wrote: Alex wrote: Hi, I have a query that runs pretty slow and tried to use exp

Re: [GENERAL] Help needed with QueryPlan

2004-12-14 Thread Richard Huxton
Alex wrote: Hi, I have a query that runs pretty slow and tried to use explain to see where the problem is. Both tables have 2.1 and 2.8 million records. In the Explain output I see that a Seq Scan is used on nval_price_hist what I dont quite understand. Could some one help me creating the correct i

Re: [GENERAL] HELP speed up my Postgres

2004-11-25 Thread Anatoly Okishev
SQL: update SUBSCRIPTIONTABLE set ACTIVEFLAG='Y' where mobile_num in (select mobile_num from LOADED_MOBILE_NUMBERS) You can try this: update SUBSCRIPTIONTABLE, LOADED_MOBILE_NUMBERS set SUBSCRIPTIONTABLE.ACTIVEFLAG='Y' where LOADED_MOBILE_NUMBERS.mobile_num=SUBSCRIPTIONTABLE.mobile_num Anatoly.

Re: [GENERAL] Help with syntax for timestamp addition

2004-11-22 Thread Scott Nixon
> So I think what you probably *really* want is > > ... WHERE CAST(date AS date) + numdays <= CURRENT_DATE; Thanks Tom! Yeah, I guess you are right on that point. I hadn't thought about that. The implementation of this wouldn't be affected since this query is buried in a script that runs

Re: [GENERAL] Help with syntax for timestamp addition

2004-11-22 Thread Tom Lane
Scott Nixon <[EMAIL PROTECTED]> writes: > Am having some trouble with a query that worked in 7.0 but not in > 7.3.can't seem to figure out the syntax or find info about how to do > this anywhere. > SELECT number > FROM procedures > WHERE date + numdays <= CURRENT_TIMESTAMP; > In 7.0 this wo

Re: [GENERAL] Help with syntax for timestamp addition

2004-11-22 Thread Scott Nixon
> Just to add to the record, the mathematically sound way to write this > query would be this: > > SELECT number > FROM procedures > WHERE date + numdays * interval '1 day' <= current_timestamp; Thanks for that Peter! That's a lot closer than what I originally had...I didn't think about doing

Re: [GENERAL] Help with syntax for timestamp addition

2004-11-22 Thread Peter Eisentraut
Ian Barwick wrote: > On Mon, 22 Nov 2004 15:12:26 +0100, Patrick Fiche > > <[EMAIL PROTECTED]> wrote: > > Have a try at this syntax > > > > SELECT number > > FROM procedures > > WHERE date + CAST( numdays || ' days' AS interval ) <= > > CURRENT_TIMESTAMP; > > Just for the record you could write it

Re: [GENERAL] Help with syntax for timestamp addition

2004-11-22 Thread Ian Barwick
On Mon, 22 Nov 2004 15:12:26 +0100, Patrick Fiche <[EMAIL PROTECTED]> wrote: > Have a try at this syntax > > SELECT number > FROM procedures > WHERE date + CAST( numdays || ' days' AS interval ) <= CURRENT_TIMESTAMP; Just for the record you could write it like this too: SELECT number FROM proc

Re: [GENERAL] Help with syntax for timestamp addition

2004-11-22 Thread Scott Nixon
> Have a try at this syntax > > SELECT number > FROM procedures > WHERE date + CAST( numdays || ' days' AS interval ) <= CURRENT_TIMESTAMP; > > Patrick > Cool! Thanksthat works perfectly. -Scott ---(end of broadcast)--- TIP 2: you ca

Re: [GENERAL] Help with syntax for timestamp addition

2004-11-22 Thread Patrick Fiche
Have a try at this syntax SELECT number FROM procedures WHERE date + CAST( numdays || ' days' AS interval ) <= CURRENT_TIMESTAMP; Patrick > -- - > Patrick Fiche > email : [EMAIL PROTECTED] > tél : 01 69 29 36

Re: [GENERAL] Help on copy function

2004-10-06 Thread Doug McNaught
Tom Lane <[EMAIL PROTECTED]> writes: > Doug McNaught <[EMAIL PROTECTED]> writes: >> It's also possible that PG is trying to create a new table file and >> he's out of inodes... > > Good thought, although I think that this particular error message would > only come out from a seek/write failure an

Re: [GENERAL] Help on copy function

2004-10-06 Thread Tom Lane
Doug McNaught <[EMAIL PROTECTED]> writes: >>> psql:lineitem.loader.psql:1: ERROR: could not extend relation >>> 24342131/24342133 >>> /24342324: There is not enough space in the file system. >>> HINT: Check free disk space. >> >> Maybe you are running the postmaster under a disk-space-usage limi

Re: [GENERAL] Help on copy function

2004-10-06 Thread Doug McNaught
Tom Lane <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] writes: >> And an error occurs : >> psql:lineitem.loader.psql:1: ERROR: could not extend relation >> 24342131/24342133 >> /24342324: There is not enough space in the file system. >> HINT: Check free disk space. > >> but my fileSystem has s

Re: [GENERAL] Help on copy function

2004-10-06 Thread Tom Lane
[EMAIL PROTECTED] writes: > And an error occurs : > psql:lineitem.loader.psql:1: ERROR: could not extend relation > 24342131/24342133 > /24342324: There is not enough space in the file system. > HINT: Check free disk space. > but my fileSystem has something like 2Go free when copy fails! Maybe

Re: [GENERAL] help with trigger

2004-08-27 Thread Dino Vliet
Maybe I've missed it but can someone plese help me with this? Brgds and thanks in advance, --- Dino Vliet <[EMAIL PROTECTED]> wrote: > Hi folks, > I'm new to PostgreSQL and am busy tring to work with > it. Of pl/pgsql I know even less and that's the part > I > have a question on right now. I hav

Re: [GENERAL] Help with optimizing query

2004-08-20 Thread Dann Corbit
If you supply the following: 1. The schema (including available indexes) for each table in the query 2. The actual query 3. The row counts for the tables via select count(*) I suspect that someone can formulate a query that is as fast as you need. > -Original Message- > From: [EMAIL PRO

Re: [GENERAL] Help with optimizing query

2004-08-20 Thread Gaetano Mendola
Marek Lewczuk wrote: Hello, I have a query, which is quite big and there is a huge difference between execution time in MySQL and PostgreSQL. I think that I have made all possible steps to increase the speed of the query, but unfortunately it is still about 100 times slower. I'm out of ideas wh

Re: [GENERAL] help required

2004-07-12 Thread Rajesh Kumar Mallah
Ramesh Yeligar wrote: Hi, We have been using pgsql for our retail business, now, due hard drive crash, the databse corrupted and we are unable to start pgsql database. Pl help me if you know any commands or tools to recover this database. What do you have in hand? like the PGDATA folder pg_xlog

Re: [GENERAL] Help needed on time data types

2004-07-12 Thread Peter Eisentraut
mike wrote: > All the date-time types seem to only be for specific time dates and > not for a running total. You probably want the interval type. ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (sen

Re: [GENERAL] Help needed on time data types

2004-07-12 Thread Michal Taborsky
mike wrote: I cannot seem to find a field type in postgres that is equivalent to h:mm without enforcing a 24 hour day limit. This seems to preclude pg from use - am I correct? You want to use "interval" data type and then do some formatting on the output to get 123 hours 30 minutes. See: http://w

Re: [GENERAL] HELP

2004-07-09 Thread Richard Huxton
Marek Nowiński wrote: I accidentaly deleted over 1.000.000 records from one table in my database. Is there any way to recover them? Please help me as soon as possible... After the records were deleted, no other operation was made on the database. In fact, all the postgres services were shut down. I

Re: [GENERAL] help required

2004-07-08 Thread Alvaro Herrera
On Mon, Jul 05, 2004 at 05:40:34PM +0800, Ramesh Yeligar wrote: > We have been using pgsql for our retail business, now, due hard drive > crash, the databse corrupted and we are unable to start pgsql > database. Pl help me if you know any commands or tools to recover this > database. You'd need t

Re: [GENERAL] Help with query: indexes on timestamps

2004-07-07 Thread Keith C. Perry
Quoting Richard Huxton <[EMAIL PROTECTED]>: > Keith C. Perry wrote: > > > > I have a table with with 1 million records in it. Here is the definition > > > > CREATE TABLE report > > ( > > match int4, > > action varchar(16), > > stamp timestamptz, > > account varchar(32), > > ipaddress

Re: [GENERAL] Help with query: indexes on timestamps

2004-07-07 Thread Richard Huxton
Keith C. Perry wrote: I have a table with with 1 million records in it. Here is the definition CREATE TABLE report ( match int4, action varchar(16), stamp timestamptz, account varchar(32), ipaddress inet, profile varchar(16), rating text, url text ) WITHOUT OIDS; The is one index

Re: [GENERAL] Help please - completely baffled by quoting

2004-06-20 Thread Tim Robinson
> -Original Message- > From: Peter Eisentraut [mailto:[EMAIL PROTECTED] > Sent: 20 June 2004 14:07 > To: Tim Robinson; [EMAIL PROTECTED] > Subject: Re: [GENERAL] Help please - completely baffled by quoting > > > Tim Robinson wrote: > > sele

Re: [GENERAL] Help please - completely baffled by quoting

2004-06-20 Thread Peter Eisentraut
Tim Robinson wrote: > select * from temp where a like 'a\\\'%' > > this should return all strings starting with a\' but it returns > nothing!!! \ is also the quoting character of LIKE, in addition to being a quoting character on the string literal level. If you want all strings starting w

Re: [GENERAL] Help in finding the error

2004-06-08 Thread Tom Lane
Duane Lee - EGOVX <[EMAIL PROTECTED]> writes: > I'm trying to insert data into an empty table but I keep getting the error: > ERROR: could not open relation with OID 42939 More detail please? For starters, what PG version is this? > I have a couple of constraints on the table but what I'm ente

Re: [GENERAL] help needed regarding Query processing in postgres

2004-04-10 Thread Bruce Momjian
[EMAIL PROTECTED] wrote: > hi all, > > I am an M.Tech student of IITBombay,india. > We are doing a project on access control in postgres. > > Is there any way in which, i can add a extra predicate to the sql query > given to the postgres database table. > > please if any body could help me in th

Re: [GENERAL] Help with a query

2004-02-27 Thread Bas Scheffers
Klint, > select groname from pg_group > where (select usesyside from pg_shadow where usename = 'postgres') = > any(grolist); Unless you are lgged in as superuser (and applications other than pgAdmin et al shouldn't be) you will get access denied on pg_shadow. (because it contains passwords) Select

Re: [GENERAL] Help with a query

2004-02-27 Thread Bas Scheffers
If the user/groups you are talking about are postgres users and groups, this is it: select * from pg_catalog.pg_group where (select usesysid from pg_catalog.pg_user where usename = 'user') = any(grolist) The place to find this kind of thing is the Postgres Internals section (system catalogs) that

Re: [GENERAL] Help with a query

2004-02-26 Thread Klint Gore
On Thu, 26 Feb 2004 16:47:10 -0500, Alexander Cohen <[EMAIL PROTECTED]> wrote: > Im trying to get a list of all groups that a certain user is a member > of. Can anyone help me with the sql to get that? select groname >from pg_group where (select usesyside from pg_shadow where usename = 'postgres'

Re: [GENERAL] HELP with a Query

2004-02-21 Thread Martijn van Oosterhout
On Sat, Feb 21, 2004 at 05:20:51PM +0900, Alex wrote: > Hi, > I need some help with a query. > I use a reference table to lookup some codes. Everything works well if the > reference table contains a reference but the query fails if no reference > fails (Z.ref_code=123456). What I need to is eithe

Re: [GENERAL] help with query speed

2004-02-12 Thread Richard Huxton
On Thursday 12 February 2004 19:32, Jason Tesser wrote: > Hi > > > Is there an index on: > > testclass.classid > I created the indexes and it speed up a little. Still a little slower > than Access though. Which I think should not be. The testclass is a view > not A query so I cannot make an ind

Re: [GENERAL] help with query speed

2004-02-12 Thread scott.marlowe
On Thu, 12 Feb 2004, Jason Tesser wrote: > Hi > > > > I have the below query written. I have removed a lot from the > select > > > Statement for simplicity sake. The query takes way too long. > > > I am moving from an Access backend to a Postgres back with > > > Access in the front. The below

Re: [GENERAL] help with query speed

2004-02-12 Thread Dann Corbit
> -Original Message- > From: Jason Tesser [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 12, 2004 10:03 AM > To: [EMAIL PROTECTED] > Subject: [GENERAL] help with query speed > > > I have the below query written. I have removed a lot from the select > Statement for simplicity sake

Re: [GENERAL] help with query speed

2004-02-12 Thread Jason Tesser
> You didn't answer my question about whether they are the same types. Are > they? Yes but testclass is a view. But the field it is referencing is of the same type. ---(end of broadcast)--- TIP 7: don't forget to increase your free space map set

Re: [GENERAL] help with query speed

2004-02-12 Thread scott.marlowe
On Thu, 12 Feb 2004, Jason Tesser wrote: > I have the below query written. I have removed a lot from the select > Statement for simplicity sake. The query takes way too long. > I am moving from an Access backend to a Postgres back with > Access in the front. The below query is taking like 14-20

Re: [GENERAL] help with query speed

2004-02-12 Thread Jason Tesser
Hi > > I have the below query written. I have removed a lot from the select > > Statement for simplicity sake. The query takes way too long. > > I am moving from an Access backend to a Postgres back with > > Access in the front. The below query is taking like 14-20 seconds. > > Is their a bette

Re: [GENERAL] Help, I've killed my system?

2004-01-28 Thread Tom Lane
Dean Grubb <[EMAIL PROTECTED]> writes: > I have a debian server running postgresql 7.03 from the packages > and also postgresql 7.1.3 from source. After doing an upgrade to some > system files (ahrr...apt-get is good but I like freeBSD ports) I > find that I no longer have the postgresql 7.03 >

Re: [GENERAL] Help, I've killed my system?

2004-01-28 Thread Martijn van Oosterhout
On Wed, Jan 28, 2004 at 05:01:32PM +1100, Dean Grubb wrote: > Hi, > > I have a debian server running postgresql 7.03 from the packages > and also postgresql 7.1.3 from source. After doing an upgrade to some > system files (ahrr...apt-get is good but I like freeBSD ports) I > find that I no lon

Re: [GENERAL] Help with PostgreSQL porting project

2004-01-02 Thread Chris Travers
TECTED]>; <[EMAIL PROTECTED]> Sent: Friday, January 02, 2004 7:20 PM Subject: Re: [GENERAL] Help with PostgreSQL porting project > Enver ALTIN wrote: > > > Hi, > > > > On Fri, 2004-01-02 at 13:38, Chris Travers wrote: > > > >>A few years ago, I set about

Re: [GENERAL] Help with PostgreSQL porting project

2004-01-02 Thread Enver ALTIN
Hi, On Fri, 2004-01-02 at 14:20, Arjen van der Meijden wrote: > Are those two LIGHT weight? > Afaik, PEAR (DB) affects the performance of your OO-php-app quite bad, > but I haven't really tested it very often myself, just seen tests by others? > And I'm not talking "quite bad, because php is not

Re: [GENERAL] Help with PostgreSQL porting project

2004-01-02 Thread Arjen van der Meijden
Enver ALTIN wrote: Hi, On Fri, 2004-01-02 at 13:38, Chris Travers wrote: A few years ago, I set about porting a PHP application from MySQL to PostgreSQL, after realizing that MySQL wasn't going to be able to handle it. In order to do this, I built a light, fast database abstraction layer which c

Re: [GENERAL] Help with PostgreSQL porting project

2004-01-02 Thread Enver ALTIN
Hi, On Fri, 2004-01-02 at 13:38, Chris Travers wrote: > A few years ago, I set about porting a PHP application from MySQL to > PostgreSQL, after realizing that MySQL wasn't going to be able to handle it. > In order to do this, I built a light, fast database abstraction layer which > conforms to th

Re: [GENERAL] Help With date/time

2003-11-08 Thread Steve Crawford
On Saturday 08 November 2003 9:04 am, Alex wrote: > Hi, > I want to remove data that is older that a certain number of > months.. only full months. > > example: today is 11-08 and I want do delete all data that is older > than this month - 3 month i.e. i want to delete all information > that is old

Re: [GENERAL] Help on update that subselects other records in table, uses joins

2003-11-06 Thread Manfred Koizar
On Thu, 6 Nov 2003 00:50:06 +0900, Michael Glaesemann <[EMAIL PROTECTED]> wrote: >>> What I came up with was deleting and reinserting the relevant >>> ordercharges rows >> >> This might have unwanted side effects (think ON DELETE CASCADE). > >Good point. At this stage in my PostgreSQL progress, I h

Re: [GENERAL] Help on update that subselects other records in table, uses joins

2003-11-05 Thread Michael Glaesemann
Manfred, Thanks for taking the time to walk me through this. You've pointed out things I've noticed when writing queries and wondered about. (More specific comments—and commentary—below. What I came up with was deleting and reinserting the relevant ordercharges rows This might have unwanted sid

Re: [GENERAL] Help on update that subselects other records in table, uses joins

2003-11-05 Thread Manfred Koizar
On Wed, 5 Nov 2003 02:58:28 +0900, Michael Glaesemann <[EMAIL PROTECTED]> wrote: >> UPDATE ordercharges >>SET orderchargeasbilled = 0.065 * sale.orderchargeasbilled >> FROM orders AS o, ordercharges AS sale >> WHERE ordercharges.orderchargecode = 'S&H' >>AND ordercharges.orderid = o.orde

Re: [GENERAL] help from Portugal

2003-10-31 Thread Fernando Schapachnik
Looks like the new DB might have been initialized with a different locale. Read about locales and initdb in the docs. Good luck. Fernando. En un mensaje anterior, Pedro Miguel Guedes escribió: [...] > > The problem seems to be on accent on letters. So I thought maybe some stuff > on charsets/en

Re: [GENERAL] Help or Bug?

2003-10-20 Thread Richard Huxton
On Monday 20 October 2003 16:19, Cláudia Morgado wrote: > Tom Lane, > > This problem was solved with the suggested permission. > > GRANT USAGE ON SCHEMA wlog_data TO wlog_uni; > > There is the possibility of us to consult the permission above in the > database? SELECT * FROM pg_namespace ; For ta

Re: [GENERAL] help with TCL function

2003-09-11 Thread darren
Ok you can user the info exists function that is part of TCL i.e. if { [info exists NEW($1)] } { or if 1 is the problem do if { [info exists 1] } { This will allow you to determine if it exists. If you want to see what variables exist at this level elog [info vars] and it will show you all var

Re: [GENERAL] help with TCL function

2003-09-11 Thread Jules Alberts
Op 11 Sep 2003 (0:45), schreef ljb <[EMAIL PROTECTED]>: > I think you're missing something. When you use a Tcl function as a > trigger, any arguments (like $1) are explicitly supplied in the CREATE > TRIGGER command. You either define the trigger to call the function with > a constant argument or

Re: [GENERAL] help with TCL function

2003-09-11 Thread Rolf Jentsch
Am Donnerstag, 11. September 2003 08:59 schrieben Sie: > Op 11 Sep 2003 (0:45), schreef ljb <[EMAIL PROTECTED]>: ... > -- This is the function > > create or replace function tlow() returns trigger as ' > set NEW($1) [string tolower $NEW($1)] > return [array get NEW]' > language 'pltcl'; > ...

Re: [GENERAL] help with TCL function

2003-09-10 Thread Richard Huxton
On Wednesday 10 September 2003 14:27, Jules Alberts wrote: > > I use it to force lowercase of values inserted in the db. There is one > problem though, if the parameter is absent, the function will give an > error message. I would like it to rather check for null before tolower > is applicated. In

<    3   4   5   6   7   8   9   >