[SQL] pg_type and type names

2003-09-04 Thread sad
hello developers,
 another question i have to ask:

 may the type names changes in the future releases?
 may the type oids changes...?

 I need look-up system catalog for a type of a field,
 so i need a constancy of some kind :-)


---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [SQL] Fw: Change column data type

2003-09-04 Thread scott.marlowe
On Tue, 2 Sep 2003, Kumar wrote:

> 
> Dear Friends,
> 
> Using Postgres 7.3.4 over the linux server 7.3. 
> 
> Is it possible to alter/change the data type of a existing table's 
> column, with out dropping and recreating a column of same name.

Only for certain types, and only by hacking the system catalogs, which is 
a procedure fraught with danger.  i.e. backup all your data, then proceed 
with caution.

Generally, it's best to create a new column and put the data in there and 
drop the old column.  Note you can do this in a transaction, so you can 
roll it back should you realize you've made some kind of error.

begin;
alter table t1 add column c1 int8;
update t1 set c1=c2;
alter table t1 drop column c2;
commit;
vacuum;


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


[SQL] Change column data type

2003-09-04 Thread Senthil Kumar S



Dear Friends,
 
Using Postgres 7.3.4 over the linux server 7.3. 
 
Is it possible to alter/change the data type of a existing 
table's column, with out dropping and recreating a column of same 
name.
 
Thanks for ur knowledge sharing.
 
 
Regards
Kumar
 



[SQL] running aggregates

2003-09-04 Thread Glenn
f1sum_f1  avg_f1  pseudo_recno
10  10  10  1
20  30  15  2
30  60  20  3
40  100 25  4
50  150 30  5
60  210 35  6

I know I can do this by iterating with a plpgsql routine, but there must
be a means simply using SQL

Thanks in advance
Glenn
ps sorry if this isn't the appropriate use for this forum

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


[SQL] MINUS & ROWNUM in PostGres

2003-09-04 Thread Jomon Skariah

Hi,

We are in the process of migrating of our application from Oracle to
PostGreSQL.


we are  facing a few problems with PL/SQL Code..

1)  Do we have a replacement in PostGres for MINUS operator of Oracle .

2   Also I need to find an alternative for ROWNUM in oracle..

Can anyone help ..


Regards

Jomon


---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [SQL] MINUS & ROWNUM in PostGres

2003-09-04 Thread Rod Taylor
> 1)Do we have a replacement in PostGres for MINUS operator of Oracle .

I believe MINUS is non-standard word for EXCEPT, correct?

> 2 Also I need to find an alternative for ROWNUM in oracle..

If you are looking for a unique identifier, try using the OID.



signature.asc
Description: This is a digitally signed message part


Re: [SQL] running aggregates

2003-09-04 Thread Tomasz Myrta
f1sum_f1  avg_f1  pseudo_recno
10  10  10  1
20  30  15  2
30  60  20  3
40  100 25  4
50  150 30  5
60  210 35  6
I know I can do this by iterating with a plpgsql routine, but there must
be a means simply using SQL
select f1
 t1.f1,
 sum(t2.f1) as sum_f1,
 avg(t2.f1) as avg_f1,
 count(*) as pseudo_recno
from
  ttt t1
  join ttt t2 on (t2.f1<=t1.t1)
group by t1.f1
order by t1.f1;
Regards,
Tomasz Myrta
---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
 joining column's datatypes do not match


[SQL] Help me

2003-09-04 Thread Yaroslav Ulyanov




Hello
 
I cannot write new function with local variables 
(see image in attachment).
 
That I do wrong?
 
 
Best regards,Yaroslav Ulyanov[EMAIL PROTECTED] 
<>
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [SQL] Help me

2003-09-04 Thread George Weaver



Hi Yaroslav,
 
You must set the language as:
 
  LANGUAGE 'plpgsql';
 
Regards,
George

  - Original Message - 
  From: 
  Yaroslav Ulyanov 
  
  To: [EMAIL PROTECTED] 
  Sent: Thursday, September 04, 2003 2:46 
  AM
  Subject: [SQL] Help me
  
  
  Hello
   
  I cannot write new function with local variables 
  (see image in attachment).
   
  That I do wrong?
   
   
  Best regards,Yaroslav Ulyanov[EMAIL PROTECTED] 
  
  

  ---(end of 
  broadcast)---TIP 5: Have you checked our extensive 
  FAQ?   
  http://www.postgresql.org/docs/faqs/FAQ.html