Re: [SQL] Scheduling Events?

2003-01-23 Thread Achilleus Mantzios
On Thu, 23 Jan 2003, David Durst wrote: > Is there anyway to schedule DB Events based on time? Yes! cron > So lets say I had a table w/ depreciation schedules in it, > I would like the DB to apply the formula and make the entries on the END > of every month. > > > > ---(e

[SQL] quastions about primary key

2003-01-23 Thread jack
Is that possible to have a two columns primary key on a table with null value on second column? Jack ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that

Re: [SQL] Scheduling Events?

2003-01-23 Thread David Durst
On a side note, if the DB doesn't support this capability. Does anyone see a HORRIBLE issue w/ creating a C func something of this nature. int handle_temporal_events() { if(fork == 0) { //In here we monitor what time it is //And maintain a Datastructure w/ events //And update it eve

Re: [SQL] CAST from VARCHAR to INT

2003-01-23 Thread Tom Lane
"Luke Pascoe" <[EMAIL PROTECTED]> writes: > Now I'm trying to correct my mistake, I've created a new table and I'm > trying to INSERT INTO...SELECT the data into it, but it's complaining that > it can't stick a VARCHAR into an INT. All the values in the column are valid > integers (the foreign key

Re: [SQL] CAST from VARCHAR to INT

2003-01-23 Thread Bhuvan A
> (Postgres 7.2.1) > > I screwed up when I was designing a table a while back and made a column a > VARCHAR that referenced (and should have been) an INT. > > Now I'm trying to correct my mistake, I've created a new table and I'm > trying to INSERT INTO...SELECT the data into it, but it's compla

Re: [SQL] Scheduling Events?

2003-01-23 Thread Roberto Mello
On Thu, Jan 23, 2003 at 04:16:52PM -0800, David Durst wrote: > Is there anyway to schedule DB Events based on time? > So lets say I had a table w/ depreciation schedules in it, > I would like the DB to apply the formula and make the entries on the END > of every month. 1) Write a script that invok

Re: [SQL] SQL to list databases?

2003-01-23 Thread Roberto Mello
On Thu, Jan 23, 2003 at 02:33:55PM -0600, Kristopher Yates wrote: > I have been wondering the same thing.. SELECT * FROM pg_databases ? > >Is there a query that will return all the databases available, similar > >to what psql -l does? The handy "-E" flag to psql helps: roberto@brasileiro:~$

[SQL] CAST from VARCHAR to INT

2003-01-23 Thread Luke Pascoe
(Postgres 7.2.1) I screwed up when I was designing a table a while back and made a column a VARCHAR that referenced (and should have been) an INT. Now I'm trying to correct my mistake, I've created a new table and I'm trying to INSERT INTO...SELECT the data into it, but it's complaining that it c

[SQL] plpgsql: debugging

2003-01-23 Thread Oliver Vecernik
Hi, Searching Google I found a thread in July 2001 concerning the facilities for debugging plpgsql functions. The actual answer was: it should be improved. What is the best way to debug a plpgsql function? Oliver -- VECERNIK Datenerfassungssysteme A-2560 Hernstein, Hofkogelgasse 17 Tel.: +43

Re: [SQL] cannot create function that uses variable table name

2003-01-23 Thread Beth
Thanks for your reply David... 1)The "" round Retired are to label the column/field 'Retired' rather than 'retired' (someone else created the database with Upper case titles!) 2) Your code is correct.. cept that single quotes have to be escaped(?!) so the following will do the trick when updating

[SQL] Scheduling Events?

2003-01-23 Thread David Durst
Is there anyway to schedule DB Events based on time? So lets say I had a table w/ depreciation schedules in it, I would like the DB to apply the formula and make the entries on the END of every month. ---(end of broadcast)--- TIP 3: if posting/read

Re: [SQL] SQL to list databases?

2003-01-23 Thread Steve Crawford
psql -E causes psql to show it's "behind the scenes" queries to try: psql -lE (that's a lower case ell before the E) Cheers, Steve On Thursday 23 January 2003 10:56 am, Ben Siders wrote: > Is there a query that will return all the databases available, similar > to what psql -l does? > > > >

Re: [SQL] SQL to list databases?

2003-01-23 Thread Keith Keller
On Thu, Jan 23, 2003 at 12:56:50PM -0600, Ben Siders wrote: > > Is there a query that will return all the databases available, similar > to what psql -l does? Any time you wish to know what psql is doing with ''meta'' commands (like the \ commands), use the -E switch, which will display the quer

[SQL] Rename database?

2003-01-23 Thread Wei Weng
Can I use a SQL statement to rename database?   e.g Rename Database Bank to Database Bank_backup   Thanks!   Wei  

Re: [SQL] SQL to list databases?

2003-01-23 Thread Kristopher Yates
I have been wondering the same thing.. Thanks Kris Ben Siders wrote: Is there a query that will return all the databases available, similar to what psql -l does? ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://a

Re: [SQL] SQL to list databases?

2003-01-23 Thread Larry Rosenman
--On Thursday, January 23, 2003 12:56:50 -0600 Ben Siders <[EMAIL PROTECTED]> wrote: Is there a query that will return all the databases available, similar to what psql -l does? $ psql -E -l * QUERY ** SELECT d.datname as "Name", u.usename as "Owner", pg_catalog.p

Re: [SQL] To use a VIEW or not to use a View.....

2003-01-23 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > On Thu, 23 Jan 2003, Tom Lane wrote: >> What I was thinking was that any time the code sees a "var = const" >> clause as part of a mergejoin equivalence set, we could mark all the >> "var = var" clauses in the same set as no-ops. For example, given >> WH

[SQL]

2003-01-23 Thread Bruce Becker
Hi one and all, Could some one tell me if there is a command or script that will inform me of every foreign constraint constructed in my tables? I would greatly appreciate it. Thank you Bruce [EMAIL PROTECTED] ---(end of broadcast)--- TIP 4: Do

Re: [SQL] cannot create function that uses variable table name

2003-01-23 Thread Beth
As per Matthew Nuzum's post My query is very similar... I need sql functions to update the database. If I specify the filename etc they work. BUT that leads to 6 functions which are exactly the same apart from the file they update. 1) why can't I use a variable name and 2) could someone please p

Re: [SQL] [GENERAL] sort by relevance

2003-01-23 Thread Björn Metzdorf
> How am I able to sort query results by relevance? > I use contrib/tsearch to search using fill text index! I think you need to use OpenFTS (openfts.sf.net). tsearch does not provide relevance ranking at this time. Regards, Bjoern ---(end of broadcast)--

[SQL] SQL to list databases?

2003-01-23 Thread Ben Siders
Is there a query that will return all the databases available, similar to what psql -l does? ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] CREATE VIEW ERROR

2003-01-23 Thread Igor
I found answer. Thank you for everyone who did not reply. CREATE VIEW depend_view AS SELECT depend.subfunction_id, a.subfunction_file AS x, depend.subfunction_dep_id, b.subfunction_file AS y FROM depend INNER JOIN subfunction a ON depend.subfunction_id = a.subfunction_id INNER JOIN subfunction b

Re: [SQL] To use a VIEW or not to use a View.....

2003-01-23 Thread Stephan Szabo
On Thu, 23 Jan 2003, Tom Lane wrote: > regression=# explain analyze select * from tenk1 a join tenk1 b using(ten) > regression-# where ten = 3; > QUERY PLAN > >--

Re: [SQL] To use a VIEW or not to use a View.....

2003-01-23 Thread jasiek
On Thu, Jan 23, 2003 at 08:53:53AM -0800, Stephan Szabo wrote: > On Wed, 22 Jan 2003, Tom Lane wrote: > > I haven't looked at code yet but tried examples like Tomasz's and some > simple ones and have gotten reasonable seeming output for the estimates > given accurate statistics (joining two estima

Re: [SQL] To use a VIEW or not to use a View.....

2003-01-23 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > On Wed, 22 Jan 2003, Tom Lane wrote: >> It could still use more eyeballs looking at it. One thing I'm concerned >> about is whether the extra (derived) conditions lead to double-counting >> restrictivity and thus underestimating the number of result rows

Re: [SQL] calling function from rule

2003-01-23 Thread Tom Lane
"Tambet Matiisen" <[EMAIL PROTECTED]> writes: >> Try 7.3, we changed the rules about returned records count. > I have 7.3. When rule and action are the same, everything works fine. > Doing an insert in update rule and opposite are OK too. Problem is, > when I do select in insert/update/delete rule

Re: [SQL] To use a VIEW or not to use a View.....

2003-01-23 Thread Stephan Szabo
On Wed, 22 Jan 2003, Tom Lane wrote: > Stephan Szabo <[EMAIL PROTECTED]> writes: > > On Wed, 22 Jan 2003, Tom Lane wrote: > >> Stephan Szabo <[EMAIL PROTECTED]> writes: > >>> The filter is applied only to a. So, if you really wanted the > >>> c.a=3 condition to be applied for whatever reason you'

Re: [SQL] calling function from rule

2003-01-23 Thread Tambet Matiisen
> > "Tambet Matiisen" <[EMAIL PROTECTED]> writes: > > I have a view and update rule on it, which updates another > table. Now I would like to call a function, after update of > the table is done. Also the function must be called in the > same transaction as update. I tried to define an additio

Re: [SQL] calling function from rule

2003-01-23 Thread Tom Lane
"Tambet Matiisen" <[EMAIL PROTECTED]> writes: > I have a view and update rule on it, which updates another table. Now I would like >to call a function, after update of the table is done. Also the function must be >called in the same transaction as update. I tried to define an additional update ru

Re: [SQL] Slow query

2003-01-23 Thread Tomasz Myrta
Ricardo Javier Aranibar León wrote: I run Explain and this is the result: EXPLAIN SELECT * from simon where fecha='20030122' order by hora desc; NOTICE: QUERY PLAN: Sort (cost=57700.73..57700.73 rows=23682 width=46) -> Seq Scan on simon (cost=0.00..55591.05 rows=23682 width=46) and when I ru

[SQL] Slow query

2003-01-23 Thread Ricardo Javier Aranibar León
Hi List, I need your help, I don't know what happend with my queries when I use this table "simon".When I like display the result the query is very slow and take five minutes or more. The number of registers in simon is:2421580 and the other table "llamada" the number of registers is :1779741 b

[SQL] calling function from rule

2003-01-23 Thread Tambet Matiisen
I have a view and update rule on it, which updates another table. Now I would like to call a function, after update of the table is done. Also the function must be called in the same transaction as update. I tried to define an additional update rule on the view, but doing a SELECT in update rul

Re: [SQL] To use a VIEW or not to use a View.....

2003-01-23 Thread Tomasz Myrta
Ries van Twisk wrote: First of all I want to thank you for all responses! I was overwhelmed with it :D Below you find the schema I'm currently using and the output of explain. I removed all comments so the mail will be small, the schema is still work in progress. I especially I need to take a loo

Re: [SQL] DBCC CheckIdent in a stored proc?

2003-01-23 Thread Bhuvan A
> I need to know the last id of the last record added to the table from an > ASP page. => select field1 from my_table order by oid desc limit 1; -- will do that. regards, bhuvaneswaran ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaste

Re: [SQL] PostgreSQL + SSL

2003-01-23 Thread Bhuvan A
> I´m trying to config PG with SSL, but i got a error. I create the key > and the certificate and put both in $PGDATA directory. I also enabled > the ssl option in postgresql.conf. But when i run postmaster i got a > error saying that server.key has wrong permissions. It reports the error in eith

Re: [SQL] To use a VIEW or not to use a View.....

2003-01-23 Thread Ries van Twisk
First of all I want to thank you for all responses! I was overwhelmed with it :D Below you find the schema I'm currently using and the output of explain. I removed all comments so the mail will be small, the schema is still work in progress. I especially I need to take a look at the indexes. Any h