Re: [SQL] Automatic casting

2003-02-06 Thread Josh Berkus
Vicente, > if I try nodo_fecha_activ<= 104422680 then it gives me this error > ERROR: Unable to identify an operator '<=' for types 'numeric' and > 'double precision' This is a known problem that will be fixed in a later version of Postgres. For now, you have to cast. -Josh

Re: [SQL] 7.2 functions that return multiple result sets?

2003-02-06 Thread Ian Barwick
On Sunday 02 February 2003 22:45, mail.luckydigital.com wrote: > Can some one please confirm( with a plpgsql function example please ) a > postgres "7.2" function that can return multiple rows to the client. > > I've gone through the docs and can't find anything to support this -it > seems you can

[SQL] changing referential integrety action on existing table

2003-02-06 Thread Matthew Nuzum
I have a table that uses the NO ACTION action for it's referential integrity. I'd like to change it to CASCADE for the ON DELETE event. I'm using Postgres 7.2. I noticed that in the output of my pg_dump I have some triggers that look like: CREATE CONSTRAINT TRIGGER "RI_ConstraintTriger_*" Is it

Re: [SQL] changing referential integrety action on existing table

2003-02-06 Thread Stephan Szabo
On Thu, 6 Feb 2003, Matthew Nuzum wrote: > I have a table that uses the NO ACTION action for it's referential > integrity. I'd like to change it to CASCADE for the ON DELETE event. > I'm using Postgres 7.2. I think the best way is to drop all three triggers for the constraint and use alter table

Re: [SQL] numeric when compared to literal

2003-02-06 Thread Tom Lane
Vicente Alabau Gonzalvo <[EMAIL PROTECTED]> writes: > db=> select * from tipos where _numeric_ <= 2147483648; > ERROR: Unable to identify an operator '<=' for types 'numeric' and > 'double precision' 7.3 is more forgiving about this (although there's no free lunch --- some other cases are now le

Re: [SQL] 7.2 functions that return multiple result sets?

2003-02-06 Thread Chad Thompson
Found this using google from http://archives.postgresql.org/pgsql-sql/2002-01/msg00312.php   Depending on what you're doing (and if you're willing to work with the7.2rcs or wait for it), 7.2 allows you to define functions that returncursors that you can then fetch from within the transaction y

Re: [SQL] get # of rows while doing SELECT with LIMIT at same time ?

2003-02-06 Thread Roberto Mello
On Thu, Feb 06, 2003 at 04:01:12AM -0800, Sam Iam wrote: > In web applications like say searching it's common to show page sized > subsets of a larger result set from a query. > > It usually takes one query to get the count of the # of results in the > query set & another query to get a page sized

Re: [SQL] Returning records from a function

2003-02-06 Thread Lex Berezhny
Hi John, It is in the documentation ;-) http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html Also, this tutorial might be helpful: http://techdocs.postgresql.org/guides/SetReturningFunctions good luck, - lex On Sun, 2003-02-02 at 02:20, John C wrote: > I've sp

[SQL] get # of rows while doing SELECT with LIMIT at same time ?

2003-02-06 Thread Sam Iam
In web applications like say searching it's common to show page sized subsets of a larger result set from a query. It usually takes one query to get the count of the # of results in the query set & another query to get a page sized subset of items to show. SELECT COUNT(*) FROM albums alb, artist

Re: [SQL] How to return records from a function

2003-02-06 Thread jasiek
Did you look at http://techdocs.postgresql.org/guides/SetReturningFunctions ? You need Postgresql 7.3 to do this. Regards, Tomasz Myrta ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail com

[SQL] Serialized Transaction Locking Issues

2003-02-06 Thread Jasper Tymesman
Hello, I'm currently in the midst of working on a serializable transaction which drops indexes on several tables, does a bulk copy, and rebuilds the indexes. Based on what I've read it seemed as though I'd be able to concurrently execute read on queries against these tables, returning results

[SQL] numeric when compared to literal

2003-02-06 Thread Vicente Alabau Gonzalvo
When a numeric is compared to a literal < 2^31 - 1 it works well, but compared to a greater literal, it is casted to double precision. Why? How can I correct this without explicit cast? db=> \d tipos Table "tipos" Column | Type | Modifiers ---+-+--- _nume

[SQL] Automatic casting

2003-02-06 Thread Vicente Alabau Gonzalvo
Is there any way of doing nodo_fecha_activ<= 104422680::numeric without casting? nodo_fecha_activ is numeric if I try nodo_fecha_activ<= 104422680 then it gives me this error ERROR: Unable to identify an operator '<=' for types 'numeric' and 'double precision' --

[SQL] 7.2 functions that return multiple result sets?

2003-02-06 Thread mail.luckydigital.com
Can some one please confirm( with a plpgsql function example please ) a postgres "7.2" function that can return multiple rows to the client.   I've gone through the docs and can't find anything to support this -it seems you can only have one return value or null.   Yes i'm aware this it is

[SQL] Returning records from a function

2003-02-06 Thread John C
I've spent the last few hours trying to come up with a function that at the most basic returns the result of a SELECT * FROM . This is easy to do in something like MSSQL or Oracle. For example in MSSQL i can do something like: CREATE PROCEDURE proc_name AS BEGIN SELECT * FROM sometable END H

Re: [SQL] automatic time/user stamp - rule or trigger?

2003-02-06 Thread codeWarrior
You're doing update right ??? Just update the column... It's even easier if, when you do your updates... You just: UPDATE blah SET field = value,, updatestamp = 'Now()' WHERE condition... GP "Neal Lindsay" <[EMAIL PROTECTED]> wrote in message b1r864$2mpp$[EMAIL PROTECTED]">news:b1r864$2mpp

[SQL] conversi ms-sql7 vs postgresql 7.3

2003-02-06 Thread betty
Hi.. I have table xx: id debet credit balance 1 10000 0 2 2000 0 0 3 0 2500 0 4 0 100 0 command in ms-sql 7 can use calculate field (column) balance from id=1 to id=4: "upda

Re: [SQL] Trigger para fazer log

2003-02-06 Thread Roberto Mello
On Thu, Feb 06, 2003 at 10:06:32AM -0200, Maurício Sessue Otta wrote: > > Quando está "EXCEPTION", o que deveria ser guardado no "log" também é desfeito. >Quando coloco "NOTICE", a > informação vai para o LOG. > > Como fazer para o trigger gerar uma "EXCEPTION" e mesmo assim gravar em outra >ta

Re: [SQL] Trigger para fazer log

2003-02-06 Thread Tomasz Myrta
Maurício Sessue Otta wrote: Oi lista, tenho um trigger que deve validar alguns campos para entrada/saida de funcionarios e que deve fazer um "log" do que vai acontecendo. Por exemplo: quando é o início do expediente, o trigger deverá guardar algo assim no "log": Cadastro da Entrada-1: Data 2

Re: [SQL] TIME vs. TIMESTAMP data type

2003-02-06 Thread Julian Scarfe
On 6/2/03 11:04, "Ludwig Lim" <[EMAIL PROTECTED]> wrote: > Are there cases when a TIME data type is a better > choice over the TIMESTAMP data type? Surely this depends on the nature of the data that you want to represent? If you're researching into sleep patterns and want to represent the time

Re: [SQL] Lock timeout detection in postgres 7.3.1

2003-02-06 Thread Christoph Haller
> > > > T1 (within psql): > > BEGIN; DELETE FROM ; > > DELETE n > > > > T2 (within psql): > > BEGIN; DELETE FROM ; > > > > ... > >I don't think there is a deadlock in the example > given above. If I'm not mistaken a deadlock occurs if > both transactions are waiting for each other to > relea

Re: [SQL] TIME vs. TIMESTAMP data type

2003-02-06 Thread Ludwig Lim
Hi Tomasz: --- Tomasz Myrta <[EMAIL PROTECTED]> wrote: > > Probably you are right, but you can cast into > timestamp before using these functions. > Do you really need to care amount of storage? I was just thinking if both TIMESTAMP and TIME have use the same amount of space (I was think TIME

[SQL] Trigger para fazer log

2003-02-06 Thread Maurício Sessue Otta
Oi lista,   tenho um trigger que deve validar alguns campos para entrada/saida de funcionarios e que deve fazer um "log" do que vai acontecendo.   Por exemplo: quando é o início do expediente, o trigger deverá guardar algo assim no "log": Cadastro da Entrada-1: Data 2003-02-06  Horário: 09:51

Re: [SQL] TIME vs. TIMESTAMP data type

2003-02-06 Thread Tomasz Myrta
Ludwig Lim wrote: Hi: Are there cases when a TIME data type is a better choice over the TIMESTAMP data type? It seems that PostgreSQL (I'm using 7.2.3) encourage its users to use TIMESTAMP over TIME data type. I said this because of the following: a) More functions for DATE and TIMES

Re: [SQL] Lock timeout detection in postgres 7.3.1

2003-02-06 Thread Ludwig Lim
--- Christoph Haller <[EMAIL PROTECTED]> wrote: > > I'm working on > PostgreSQL 7.2.3 on hppa-hp-hpux10.20, compiled by > GCC 2.95.2 > and found a similar behaviour. > > T1 (within psql): > BEGIN; DELETE FROM ; > DELETE n > > T2 (within psql): > BEGIN; DELETE FROM ; > > > The documentation

[SQL] TIME vs. TIMESTAMP data type

2003-02-06 Thread Ludwig Lim
Hi: Are there cases when a TIME data type is a better choice over the TIMESTAMP data type? It seems that PostgreSQL (I'm using 7.2.3) encourage its users to use TIMESTAMP over TIME data type. I said this because of the following: a) More functions for DATE and TIMESTAMP data types su

Re: [SQL] Lock timeout detection in postgres 7.3.1

2003-02-06 Thread Christoph Haller
> > I have recently migrated my database from MS Sql > Server to postgresql 7.3.1. In MS SQL SERVER, it is > very easy to set the lock time equals to zero on ROW > LEVEL. So that if some other user try to access the > same data, he/she will get the error immediately. I > have tried to run the same