Re: [SQL] How to figure out when was a table created

2003-10-03 Thread Bruno Wolff III
On Thu, Oct 02, 2003 at 16:01:16 -0700, David B <[EMAIL PROTECTED]> wrote: > Hi folks, > > I posted this question a few days ago and got no response so I guess it > cannot be done (surprising!) > So that leaves me with my business problem. > > We create a table for each days activity. > After N

Re: [SQL] Creating Index

2003-10-03 Thread Tom Lane
"CN" <[EMAIL PROTECTED]> writes: > I thought I have got no more question in this thread, and I was wrong :-( > Is the extra 300ms in UNION essential? Dividing, it looks like the Append node is taking about 3 microseconds per tuple, which seems kind of a lot considering it isn't really doing anythi

Re: [SQL] Data type conversion

2003-10-03 Thread Jeff Boes
Jan Pips wrote: How to convert the interval type into integer, float or any "countable" data type at the time of table creation using select ... into? I'm guessing you want something like this: SELECT EXTRACT('EPOCH' FROM INTERVAL '1 days 4 hours 15 minutes 23 seconds'); -- Jeff Boes

[SQL] help with rule and notification

2003-10-03 Thread Theodore Petrosky
I don't know if this is the correct forum for this question but I will start here... I have a job tracking system that I am developing with postgresql and mac os x. I have all the pieces in place (mostly) but i am having a problem with notify.. I am trying to set up things so that two (or more) p

Re: [SQL] Result set granularity..

2003-10-03 Thread Rasmus Aveskogh
Well, there is a rowid and a rownum in Oracle. I don't remember which, but one of them is significant to the current recieved result set only. Hence; you can use it to manipulate and restrict the result set rather than the data you're recieving from the tables. I.e. rownum 1 will always be the fir

[SQL] Data type conversion

2003-10-03 Thread Jan Pips
How to convert the interval type into integer, float or any "countable" data type at the time of table creation using select ... into? Pips ---(end of broadcast)--- TIP 8: explain analyze is your friend

[SQL] Regarding decode function

2003-10-03 Thread Buchi_Babu
Hi All,   Right now I have a query which uses decode function to get data in Oracle database, I want know is there any alternative function to decode which can do the decode functionality in Postgresql.   Thanks in advance for your great help.   Thanks Babu Mannem   

Re: [SQL] How to figure out when was a table created

2003-10-03 Thread btober
Can you add two columns to the table creation definition, one with a default current timestamp, the second to be updated with current time in an on update trigger. Then perhaps you could do something like SELECT min(new_insert_timestamp_column), max(new_update_timestamp_column) FROM your_table

[SQL] Bug in psql - Postgresql 7.3.1?

2003-10-03 Thread John B. Scalia
All,   I’m not certain if what I’m trying to do is legal, but if I execute a statement like:   UPDATE my_table SET field1=’new_value’ AND SET field2=’different_value’ WHERE my_table_id = ‘key’;   in psql, it reports that it has successfully updated one record. However, the record does

Re: [SQL] Data type conversion

2003-10-03 Thread Bruno Wolff III
On Fri, Oct 03, 2003 at 09:23:46 +0200, Jan Pips <[EMAIL PROTECTED]> wrote: > How to convert the interval type into integer, float or any "countable" data > type at the time of table creation using > select ... into? You can use extract to do that. See the date/time function documentation. Note

Re: [SQL] Bug in psql - Postgresql 7.3.1?

2003-10-03 Thread Bruno Wolff III
On Fri, Oct 03, 2003 at 09:18:44 -0400, "John B. Scalia" <[EMAIL PROTECTED]> wrote: > All, > > > > I'm not certain if what I'm trying to do is legal, but if I execute a > statement like: > > > > UPDATE my_table SET field1='new_value' AND SET field2='different_value' > WHERE my_table_id =

Re: [SQL] Bug in psql - Postgresql 7.3.1?

2003-10-03 Thread Wei Weng
Shouldn't that be "UPDATE my_table SET field1 = 'new_value', field2 = 'different_value' WHERE my_table_id = 'key';"? Wei On Fri, 3 Oct 2003, John B. Scalia wrote: > All, > > > > I'm not certain if what I'm trying to do is legal, but if I execute a > statement like: > > > > UPDATE my_tab

Re: [SQL] Bug in psql - Postgresql 7.3.1?

2003-10-03 Thread Josh Berkus
John, > > UPDATE my_table SET field1='new_value' AND SET field2='different_value' > WHERE my_table_id = 'key'; Well, your SQL is bad: UPDATE my_table SET field1='new_value, field2='different_value' WHERE my_table_id = 'key'; > in psql, it reports that it has successfully updated one record. >

Re: [SQL] Bug in psql - Postgresql 7.3.1?

2003-10-03 Thread Josh Berkus
John, > Yeah, I figured out my SQL was bad and had switched to the comma > separated version, instead. In my mind, the first form should have > caused an error. I've attached a cut-and-pasted session from psql where > I used this syntax on a test table. While edited for brevity and to > obscure pa

Re: [SQL] Bug in psql - Postgresql 7.3.1?

2003-10-03 Thread Tom Lane
"John B. Scalia" <[EMAIL PROTECTED]> writes: > UPDATE my_table SET field1='new_value' AND SET field2='different_value' > WHERE my_table_id = 'key'; The other responses have focused on your obvious syntax error, but I'm assuming you didn't actually cut-and-paste that from your psql session. > in p

[SQL] function with variable length of parameters

2003-10-03 Thread Wei Weng
How do I create one, such as the tsearch2 function in tsearch2 module. It takes arbitrary number of parameters. The only difference is that it is writtein in C, instead of PL/pgsql. I looked into the doc, doesn't say much about it. Thanks Wei ---(end of broadcast)---

Re: [SQL] Regarding decode function

2003-10-03 Thread Doris Bernloehr
Right now I have a query which uses decode function to get data in Oracle database, I want know is there any alternative function to decode which can do the decode functionality in Postgresql. Oracle: decode (value, 0, 'zero', 1, 'one', 'unknown') In PostgreSQL you have to use CASE WHEN Syntax:

[SQL] HeapTuple->t_tableOid==0 after SPI_exec

2003-10-03 Thread achill
Hi, i notice that when HeapTuple data are populated by a trigger then the table oid can be retrieved from HeapTuple->t_tableOid. When HeapTuple is populated by SPI_exec("select * from foobar when id=667"); tuple = SPI_tuptable->tvals[0] (id is PK and row with 667 exists) then tuple->t_tableOid

Re: [SQL] HeapTuple->t_tableOid==0 after SPI_exec

2003-10-03 Thread Tom Lane
[EMAIL PROTECTED] writes: > When HeapTuple is populated by > SPI_exec("select * from foobar when id=667"); > tuple = SPI_tuptable->tvals[0] (id is PK and row with 667 exists) > then tuple->t_tableOid is always 0. The result of a SELECT is never a raw table tuple, not even when it's a straight "se

Re: [SQL] HeapTuple->t_tableOid==0 after SPI_exec

2003-10-03 Thread Tom Lane
[EMAIL PROTECTED] writes: > are there gonna be changes in SPI or internal structs in 7.4? No more than usual ;-). You will need to recompile shared libraries, but (in theory) source code changes shouldn't be needed. You might want to think about upgrading elog() calls to ereport() though.

Re: [SQL] HeapTuple->t_tableOid==0 after SPI_exec

2003-10-03 Thread achill
On Fri, 3 Oct 2003, Tom Lane wrote: > > I think in 7.4 there may be an optimization that skips the tuple > projection step in this particular case, but if you can in fact see > t_tableOid in 7.4, it'd be an implementation artifact rather than > something we will promise to support in future. The