Re: [SQL] date_format in postresql

2004-07-20 Thread azah azah
Thanks Chris and Rod. I think I have a problem because not many function existing in postresql that i installed. How can i get all the build-in functions because the basic function to_char is not existing in the database? On Tue, 20 Jul 2004 22:39:38 -0400, Rod Taylor <[EMAIL PROTECTED]> wrote: >

Re: [SQL] FOR-IN-EXECUTE, why fail?

2004-07-20 Thread Gaetano Mendola
Marcos Medina wrote: I wrote the following: CREATE OR REPLACE FUNCTION escritorio.seq_valor_actual( text) RETURNS integer AS ' DECLARE secuencia ALIAS FOR $1; valor_actual integer := 0; v_query text; actual integer; BEGIN RAISE NOTICE ''el parametro tiene el siguiente valor %''

[SQL] Inherited tables and new fields

2004-07-20 Thread Jeff Boes
This feels like a flaw in the way inherited tables work. I have a "template" table used to create other tables (but not by inheritance; instead the "daughter" tables are created via create table draft_00123 as select * from draft_template where false; This is done for somewhat historical reasons,

Re: [SQL] date_format in postresql

2004-07-20 Thread Rod Taylor
On Tue, 2004-07-20 at 20:55, azah azah wrote: > Hi, > I want convert from mysql to postresql, > in mysql, query to database using the code as below: > > date_format(submittime, "%W %M %e, %Y - %r") to_char(submittime, 'format string') http://www.postgresql.org/docs/7.4/static/functions-formattin

Re: [SQL] surrogate key or not?

2004-07-20 Thread Iain
Hi, (B (Bfor my 2c worth, performance is the least important of the things you need (Bto consider regarding use of surrogate keys. (B (BI use surrogate keys for all situations except the simplest code/description (Btables, and this is only when the code has no meaning to the application. If 

[SQL] date_format in postresql

2004-07-20 Thread azah azah
Hi, I want convert from mysql to postresql, in mysql, query to database using the code as below: date_format(submittime, "%W %M %e, %Y - %r") what the format query in postresql? Anyone who can help me? Thanks -Azah- ---(end of broadcast)--- TIP 2

Re: [SQL] [GENERAL] Stored procedures and "pseudo" fields..

2004-07-20 Thread Lars Erik Thorsplass
On Tue, 20 Jul 2004 09:45:06 -0600, Scott Marlowe <[EMAIL PROTECTED]> wrote: > > Kinda like this: > > > > SELECT *, acl_check( objects.obid, ) AS mode FROM objects > > WHERE mode > 0; > > Here's the problem. In order to do the select, the query first needs to > run the where clause. I.e.: > > s

Re: [SQL] locks and triggers. give me an advice please

2004-07-20 Thread Steve Crawford
> often, I am turning triggers off and on to perform a mass operation > on a table, and i am interested how should i care of another user > operations. > > the scene is: > table t1 with user defined triggers > and many tables reference t1, (so FK triggers defined on t1) > > the operation i want to

[SQL] fail to compare between bytea output in plpgsql

2004-07-20 Thread Peter Wang
I have a function and am using cursor. All the columns I select in the cursor clause are BYTEA datatype. I need to compare the after-fetch-value for two BYTEA columns which is temp2 and temp3 shown as below. I don't think I can compare it because there is no record in temp table which I use f

[SQL] SELECT query/subquery problem

2004-07-20 Thread Caleb Simonyi-Gindele
I'm still trying to isolate issues with my SELECT query. I have a table in my veterinary software which stores my sales transactions. The pertinent columns are dat_staff_code (stores the doctor who gets credit for the sale), sys_tran_number (stores a unique transaction #), cli_credit_adj_trans_no (

Re: [SQL] How do I convice postgres to use an index?

2004-07-20 Thread Vic Ricker
The plan showed that Postgres did the proper cast on the timestamp. I think part of the problem is that I need to increase the memory allocated to effective_cache_size for the optimizer choose the proper method. (Thanks to Richard Huxton for help.) I've read that if it doesn't have enough ra

Re: [SQL] Stored procedures and "pseudo" fields..

2004-07-20 Thread Markus Bertheau
Ð ÐÑÑ, 20.07.2004, Ð 15:57, Tomasz Myrta ÐÐÑÐÑ: > On 2004-07-20 15:34, UÅytkownik Lars Erik Thorsplass napisaÅ: > > My stored procedure "acl_check()" takes two integers as parameters. > > Param1 is the object id to check acl on, Param 2 is the object id of > > the user currently using the system. T

Re: [SQL] Stored procedures and "pseudo" fields..

2004-07-20 Thread Tomasz Myrta
On 2004-07-20 15:34, UÅytkownik Lars Erik Thorsplass napisaÅ: My stored procedure "acl_check()" takes two integers as parameters. Param1 is the object id to check acl on, Param 2 is the object id of the user currently using the system. The procedure returns a positive number (1 or 3 ) if you have s

[SQL] Stored procedures and "pseudo" fields..

2004-07-20 Thread Lars Erik Thorsplass
I also posted this to the general list, which might not have been a suitable forum. -- I have recently ventured into the exciting world of stored procedures, but I have now become lost. Background: Am currently working on access control in a web application. My goal is to process access control

[SQL] surrogate key or not?

2004-07-20 Thread Markus Bertheau
Hi, I have a database that has types in them with unique names. These types are referenced from other tables through a surrogate integer key. I'm now wondering if I should eliminate that surrogate key and just use the name as the primary key. Afaiu, surrogate keys are primarily there to make joini

Re: [SQL] Problem in age on a dates interval

2004-07-20 Thread Luis Sousa
Yes, that's a much more clever solution than the one I used. Thanks Best regards, Luis Sousa Alexander M. Pravking wrote: On Mon, Jul 19, 2004 at 10:00:50AM +0100, Luis Sousa wrote: I worked around this problem returning the difference between the two dates, using extract doy from both. Anyway,