Re: [SQL] [GENERAL] Inserting a path into Database

2007-06-04 Thread Michael Glaesemann
On Jun 4, 2007, at 15:10 , Ranieri Mazili wrote: 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'); In v8.0 and later you can use dollar-quot

Re: [SQL] current_date / datetime stuff

2007-06-04 Thread Kristo Kaiv
oneliner: select date_trunc('month',now()) + ((8 - extract('dow' from date_trunc ('month',now()))||'days')::text)::interval; Kristo On 04.06.2007, at 19:39, Michael Glaesemann wrote: On Jun 4, 2007, at 10:59 , Michael Glaesemann wrote: On Jun 4, 2007, at 10:27 , Andrew Sullivan wrote:

Re: [SQL] Inserting a path into Database

2007-06-04 Thread Shoaib Mir
If you are on 8.1 you can use double qoutes ( 'C:\\Program Files\\My program' ) on in 8.2 you can use the new "backslash_quote (string)" setting. You can find help on "backslash_quote (string)" at --> http://www.postgresql.org/docs/current/static/runtime-config-compatible.html -- Shoaib Mir Ente

[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 broadcast)-

Re: [SQL] Encrypted column

2007-06-04 Thread Gary Chambers
I need to store users and passwords on a table and I want to store it encrypted, but I don't found documentation about it, how can I create a Take a look at the pgcrypto user-contributed module. -- Gary Chambers // Nothing fancy and nothing Microsoft! ---(end of broadc

[SQL] Encrypted column

2007-06-04 Thread Ranieri Mazili
Hello, I need to store users and passwords on a table and I want to store it encrypted, but I don't found documentation about it, how can I create a table with columns "user" and "password" with column "password" encrypted and how can I check if "user" and "password" are correct using a sql q

Re: [SQL] current_date / datetime stuff

2007-06-04 Thread Michael Glaesemann
On Jun 4, 2007, at 10:59 , Michael Glaesemann wrote: On Jun 4, 2007, at 10:27 , Andrew Sullivan wrote: On Mon, Jun 04, 2007 at 10:04:37AM -0500, Joshua wrote: that will return the date of the first Monday of the month? I guess you need to write a function to do this. I suppose you could

Re: [SQL] current_date / datetime stuff

2007-06-04 Thread Rodrigo De León
On 6/4/07, Joshua <[EMAIL PROTECTED]> wrote: Hello, I was hoping someone here may be able to help me out with this one: Is there anything similiar to: SELECT current_date; that will return the date of the first Monday of the month? Please let me know. Thanks, Joshua select ( select ca

Re: [SQL] current_date / datetime stuff

2007-06-04 Thread Michael Glaesemann
On Jun 4, 2007, at 10:27 , Andrew Sullivan wrote: On Mon, Jun 04, 2007 at 10:04:37AM -0500, Joshua wrote: that will return the date of the first Monday of the month? I guess you need to write a function to do this. I suppose you could do it by finding out what day of the week it is and what

Re: [SQL] current_date / datetime stuff

2007-06-04 Thread Andrew Sullivan
On Mon, Jun 04, 2007 at 10:04:37AM -0500, Joshua wrote: > that will return the date of the first Monday of the month? I guess you need to write a function to do this. I suppose you could do it by finding out what day of the week it is and what the date is, then counting backwards to the earliest

[SQL] current_date / datetime stuff

2007-06-04 Thread Joshua
Hello, I was hoping someone here may be able to help me out with this one: Is there anything similiar to: SELECT current_date; that will return the date of the first Monday of the month? Please let me know. Thanks, Joshua ---(end of broadcast)--

Re: [SQL] perlu: did I find a bug, or did I make one?

2007-06-04 Thread Bart Degryse
Well, actually I do. If there's any error, I want nothing done. But my real point was that although there are 2 records in my source table with dataareaid = 'lil' and two with dataareaid = 'bol' I still get 4 times the 'lil' error message, while I was expecting 2 times the 'lil' error message and

Re: [SQL] perlu: did I find a bug, or did I make one?

2007-06-04 Thread Tom Lane
"Bart Degryse" <[EMAIL PROTECTED]> writes: > CREATE TRIGGER "afh_test_tr" BEFORE INSERT > ON "public"."afh_test" FOR EACH ROW > EXECUTE PROCEDURE "public"."temp_func1"(); > > CREATE OR REPLACE FUNCTION "public"."temp_func1" () RETURNS trigger AS > $body$ > BEGIN > IF NEW.dataareaid =3D 'lil'

Re: [SQL] Versionning (was: Whole-row comparison)

2007-06-04 Thread Andrew Sullivan
On Mon, Jun 04, 2007 at 01:40:18PM +0300, [EMAIL PROTECTED] wrote: > case ? The nicest thing would really to have parametrized view. Is > there any fundamental reason why such a beast does not exist, or is it > only postgres (compared to higher-level RDBMS) ? I don't think there's a fundamental

Re: [SQL] Jumping Weekends

2007-06-04 Thread Pavel Stehule
Hello, you forgot on sunday. Your solution can work, but isn't too efective you can do: production_date := production_date + CASE extract(dow from production_date) WHEN 0 THEN 1 -- sunday WHEN 6 THEN 2 -- saturday ELSE 0 END; there isn't slower string comparation and it's one sql sta

[SQL] Jumping Weekends

2007-06-04 Thread Ranieri Mazili
Hello, (sorry for my poor english) It's my first post here, and my doubt is very simple (I guess). I have a function to populate a table, into "WHILE" I have the follow piece of code: --Jump Weekend IF (SELECT TO_CHAR(CAST(PRODUCTION_DATE as date),'Day')) = 'Saturday' THEN PRODUCTION

Re: [SQL] Versionning (was: Whole-row comparison)

2007-06-04 Thread christian.roche.ext
Hi Andrew, what is worrying me is that if I use a SRF, any additional WHERE condition would not be taken into account before executing the underlying query, e.g., in this request using a view, the WHERE condition would be considered in the final query : UPDATE params SET version = ver_id; SELE

[SQL] perlu: did I find a bug, or did I make one?

2007-06-04 Thread Bart Degryse
Situation: I'm writing a function that fetches data in an Oracle database and stores it in postgresql database. The function works, but I can't seem to get the error handling right. I get something but it's not what I expect. This is what I get: executing 14 generated 4 errors ERROR: lil foutje