[SQL] Using function like where clause

2007-08-09 Thread Ranieri Mazili
Hello, I have 2 questions. 1) Can I use a function that will return a string in a where clause like bellow? select * from table where my_function_making_where() and another_field = 'another_think' 2) Can I use a function that will return a string to return the list of columns that

[SQL] Restricting columns by users

2007-08-07 Thread Ranieri Mazili
Hello, I'm looking for a method to restrict columns by users on postgresql, searching in google I found what I want, but in mysql, below I reproduce the paragraph that shows what I exactly want: MySQL can also restrict access on the table level and even on the column level. What this means

[SQL] Using function like where clause

2007-08-06 Thread Ranieri Mazili
Hello, I have 2 questions. 1) Can I use a function that will return a string in a where clause like bellow? select * from table where my_function_making_where() and another_field = 'another_think' 2) Can I use a function that will return a string to return the list of columns that

[SQL] Working with dates

2007-07-05 Thread Ranieri Mazili
Hello, I need to do the following select: Number of days of month - weekends - holydays So this query will return the number of days that people can work Look that I have the holydays in one table, it's bellow: CREATE TABLE holidays ( id_holidays serial NOT NULL, dt_holiday date,

Re: [SQL] [GENERAL] Working with dates

2007-07-05 Thread Ranieri Mazili
Original Message Subject: [GENERAL] Working with dates From: Ranieri Mazili [EMAIL PROTECTED] To: [EMAIL PROTECTED], pgsql-sql@postgresql.org Date: 5/7/2007 16:00 Hello, I need to do the following select: Number of days of month - weekends - holydays So this query

[SQL] Subquery problems

2007-06-19 Thread Ranieri Mazili
Hello, I'm having another problem, I have a function that declares 12 variable, one per month and each them execute a select like bellow: *DIV_MES01 := (select count(distinct production_date) from production where extract(month from production_date) = '01' and extract(year from

Re: [SQL] [GENERAL] Subquery problems

2007-06-19 Thread Ranieri Mazili
Original Message Subject: Re:[GENERAL] Subquery problems From: Merlin Moncure [EMAIL PROTECTED] To: Ranieri Mazili [EMAIL PROTECTED] Date: 19/6/2007 10:40 On 6/19/07, Ranieri Mazili [EMAIL PROTECTED] wrote: Hello, I'm having another problem, I have a function

[SQL] Exec a text variable as select

2007-06-18 Thread Ranieri Mazili
Hello, I'm creating a function that will create a select statement into a while, this select will be stored into a text variable, after while ends I need to execute this query stored into variable, on SQLSERVER I can do: EXEC(text_variable) How can I do this on Postgres? I appreciate any

[SQL] Setting variable

2007-06-18 Thread Ranieri Mazili
Hello, I need to know why can't I do it? CREATE OR REPLACE FUNCTION lost_hours_temp(date) RETURNS text AS $BODY$ DECLARE START_DATE date; END_DATE date; QUERY text; BEGIN START_DATE := $1; END_DATE := START_DATE - interval '3 year'; The last line (END_DATE := START_DATE -

[SQL] Setting Variable - (Correct)

2007-06-18 Thread Ranieri Mazili
Hello, I'm trying do the following function: CREATE OR REPLACE FUNCTION lost_hours_temp(date) RETURNS text AS $BODY$ DECLARE START_DATE date; END_DATE date; QUERY text; BEGIN START_DATE := $1; END_DATE := START_DATE - interval '3 year'; WHILE EXTRACT(YEAR FROM START_DATE) =

Re: [SQL] [GENERAL] Setting Variable - (Correct)

2007-06-18 Thread Ranieri Mazili
Original Message Subject: Re:[SQL] [GENERAL] Setting Variable - (Correct) From: Michael Glaesemann [EMAIL PROTECTED] To: Michael Glaesemann [EMAIL PROTECTED] Date: 18/6/2007 13:15 On Jun 18, 2007, at 10:17 , Michael Glaesemann wrote: Looking over your function, I'm a little

Re: [SQL] [GENERAL] Setting Variable - (Correct)

2007-06-18 Thread Ranieri Mazili
Original Message Subject: Re:[SQL] [GENERAL] Setting Variable - (Correct) From: Michael Glaesemann [EMAIL PROTECTED] To: Ranieri Mazili [EMAIL PROTECTED] Date: 18/6/2007 13:50 [Please reply to the list so that others may benefit from and participate in the discussion

[SQL] CREATE RULE with WHERE clause

2007-06-05 Thread Ranieri Mazili
Hello, I need to create a rule, but I need that it have a WHERE clause, how bellow: CREATE RULE rule_role_sul AS ON SELECT TO t1 WHERE roles = 'role_sul' DO INSTEAD SELECT field1, field2 FROM t2; CREATE RULE rule_role_sul AS ON SELECT TO t1 WHERE roles = 'role_norte' DO

[SQL] Jumping Weekends

2007-06-04 Thread Ranieri Mazili
? I appreciate any help. Thanks Ranieri Mazili ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

[SQL] Encrypted column

2007-06-04 Thread Ranieri Mazili
? I appreciate any help Thanks Ranieri Mazili ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate

[SQL] Inserting a path into Database

2007-06-04 Thread Ranieri Mazili
Hello, I need to insert a path into a table, but because \ I have a error by postgres, so how can I insert a path like bellow into a table: insert into production values ('C:\Program Files\My program'); I appreciate any help Thanks ---(end of