Re: [SQL] Automated Backup
> Is there a way to automate the backup databases using pg_dump (like in > SQL server)? You can use cron to automate your backup process with pg_dump. regards, bhuvaneswaran ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [SQL] Datafiles for Databases
> Will the postgres create individual data file for databases? Yes. > How to get the datafile path of a database? /var/lib/pgsql/data/base/, database directory name = pg_database.oid. You can also use oid2name contrib module for finer detail. regards, bhuvaneswaran ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [SQL] is this explain good or bad???
Here are the explain analyze versions: Best regards and thanx in advance Ries explain analyze select count(*) from sq_logfile; NOTICE: QUERY PLAN: Aggregate (cost=35988.07..35988.07 rows=1 width=0) (actual time=71907.64..71907.64 rows=1 loops=1) -> Seq Scan on sq_logfile (cost=0.00..33493.86 rows=997686 width=0) (actual time=12.90..46759.12 rows=997686 loops=1) Total runtime: 71907.76 msec explain analyze select count(*) from sq_flogile; NOTICE: QUERY PLAN: Aggregate (cost=128282.68..128282.68 rows=1 width=40) (actual time=99338.92..99338.92 rows=1 loops=1) -> Hash Join (cost=8.65..125788.46 rows=997686 width=40) (actual time=34.34..93123.02 rows=997686 loops=1) -> Hash Join (cost=6.49..105832.58 rows=997686 width=36) (actual time=23.94..78411.62 rows=997686 loops=1) -> Hash Join (cost=4.75..88371.34 rows=997686 width=32) (actual time=15.68..63115.86 rows=997686 loops=1) -> Hash Join (cost=3.69..68416.56 rows=997686 width=28) (actual time=12.56..45110.94 rows=997686 loops=1) -> Hash Join (cost=2.58..50955.94 rows=997686 width=24) (actual time=9.24..23160.42 rows=997686 loops=1) -> Seq Scan on sq_logfile sl (cost=0.00..33493.86 rows=997686 width=20) (actual time=5.72..11518.14 rows=997686 loops=1) -> Hash (cost=2.26..2.26 rows=126 width=4) (actual time=3.46..3.46 rows=0 loops=1) -> Seq Scan on sq_contenttypes ct (cost=0.00..2.26 rows=126 width=4) (actual time=2.88..3.17 rows=126 loops=1) -> Hash (cost=1.09..1.09 rows=9 width=4) (actual time=3.21..3.21 rows=0 loops=1) -> Seq Scan on sq_requestmethods rm (cost=0.00..1.09 rows=9 width=4) (actual time=3.16..3.19 rows=9 loops=1) -> Hash (cost=1.05..1.05 rows=5 width=4) (actual time=3.06..3.06 rows=0 loops=1) -> Seq Scan on sq_hierarchycodes hc (cost=0.00..1.05 rows=5 width=4) (actual time=3.04..3.05 rows=5 loops=1) -> Hash (cost=1.59..1.59 rows=59 width=4) (actual time=8.20..8.20 rows=0 loops=1) -> Seq Scan on sq_resultcodes rc (cost=0.00..1.59 rows=59 width=4) (actual time=7.93..8.07 rows=59 loops=1) -> Hash (cost=1.93..1.93 rows=93 width=4) (actual time=10.34..10.34 rows=0 loops=1) -> Seq Scan on sq_clientaddrfqdn cafqdn (cost=0.00..1.93 rows=93 width=4) (actual time=9.92..10.13 rows=93 loops=1) Total runtime: 99339.49 msec -Oorspronkelijk bericht- Van: Tomasz Myrta [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 19 september 2003 8:52 Aan: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Onderwerp: Re: [SQL] is this explain good or bad??? > explain select count(*) from sq_logfile; Not too helpful. Better choice is: explain analyze select * from sq_logfile; Your explains show that selecting from view is 4 times slower than selecting from a table (35988:128282). It is possible. Anyway counting 1 million rows usualy takes a long time... Regards, Tomasz Myrta ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [SQL] virus warning
On Friday 19 September 2003 07:17, Tomasz Myrta wrote: > Hi > Recently I receive massive mail attack. This attack comes from some > postgresql mailing list users. All send-to adresses are taken from users > mailboxes which contain postgresql posts. Currently I found two kinds of > viruses: > 1. Empty post with "Undelivered message to..." body > 2. Microsoft "Dear Customer... " based on www.microsoft.com design. > Both mails contains some .exe attachement. I've been getting something similar myself. Roughly 100 per day. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] virus warning
On 19/09/2003 07:17 Tomasz Myrta wrote: Hi Recently I receive massive mail attack. This attack comes from some postgresql mailing list users. All send-to adresses are taken from users mailboxes which contain postgresql posts. Currently I found two kinds of viruses: 1. Empty post with "Undelivered message to..." body 2. Microsoft "Dear Customer... " based on www.microsoft.com design. Both mails contains some .exe attachement. Regards, Tomasz Myrta So far I've had nearly 150 of these in the last 12 hours or so. Somebody on these lists has a lot of explaining to do! Fortunately my spam filters are up to scratch and I run Linux :) Others may not be so lucky. -- Paul Thomas +--+-+ | Thomas Micro Systems Limited | Software Solutions for the Smaller Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +--+-+ ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [SQL] virus warning
So far I've had nearly 150 of these in the last 12 hours or so. Somebody on these lists has a lot of explaining to do! Fortunately my spam filters are up to scratch and I run Linux :) Others may not be so lucky. Currently I've found 45 different Return-Path values in these posts and it's growing :-( Regards, Tomasz Myrta ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [SQL] Automated Backup
Oops! [EMAIL PROTECTED] ("Kumar") was seen spray-painting on a wall: > Is there a way to automate the backup databases using pg_dump (like in SQL server)? If you can come up with a way of automating the running of programs, then I imagine that might be possible. I have heard that a program called "cron" might be used for this purpose. -- "aa454","@","freenet.carleton.ca" http://cbbrowne.com/info/x.html People can be set wondering by loading obscure personal patchable systems, and sending bug reports. Who would not stop and wonder upon seeing "Experimental TD80-TAPE 1.17, MegaDeath 2.5..."? The same for provocatively-named functions and variables in stack traces. -- from the Symbolics Guidelines for Sending Mail ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Re: [SQL] virus warning
The world rejoiced as [EMAIL PROTECTED] (Richard Huxton) wrote: > I've been getting something similar myself. Roughly 100 per day. Only 100, eh? I have been seeing that many per hour, give or take... -- "aa454","@","freenet.carleton.ca" http://cbbrowne.com/info/x.html People can be set wondering by loading obscure personal patchable systems, and sending bug reports. Who would not stop and wonder upon seeing "Experimental TD80-TAPE 1.17, MegaDeath 2.5..."? The same for provocatively-named functions and variables in stack traces. -- from the Symbolics Guidelines for Sending Mail ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [SQL] Datafiles for Databases
In the last exciting episode, [EMAIL PROTECTED] ("Kumar") wrote: > I was looking for a structure like oracle or ms Sql server in Postgres. What I have > expected is individual > datafiles for individual databases. But i cant fine such items in the > /usr/local/pgsql/data directory. > > Will the postgres create individual data file for databases? No. Just as with Oracle, PostgreSQL creates multiple files for each database. > How to get the datafile path of a database? select oid, datname from pg_database; The path for database 'datname' will be: $PGDATA/base/oid/ -- "aa454","@","freenet.carleton.ca" http://cbbrowne.com/info/x.html People can be set wondering by loading obscure personal patchable systems, and sending bug reports. Who would not stop and wonder upon seeing "Experimental TD80-TAPE 1.17, MegaDeath 2.5..."? The same for provocatively-named functions and variables in stack traces. -- from the Symbolics Guidelines for Sending Mail ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] virus warning
Hi, Yeah me too - about 150 so far today. I was thinking it's from my Debian mailing lists not PostgreSQL. Strange people these stpid virus spammers. Good luck with it all. Regards Rudi. ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
[SQL] Backup of multiple tables
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I usually backup my database with pg_backup without the -t option. But now I need to only backup certain tables(say tab1 and tab2), is this possible with pg_dump? I've tried with "pg_dump -t tab1 -t tab2" without success. - -- Andreas Joseph Krogh <[EMAIL PROTECTED]> Managing Director, Senior Software Developer OfficeNet AS - - Writing software is more fun than working. gpg public_key: http://dev.officenet.no/~andreak/public_key.asc -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/au5eUopImDh2gfQRAsu4AKC0R9WhMMlqbRAPhe+Si+zykxe5bACeLOCm VRBGOqu78we2O9IxbOTlWIc= =5Keu -END PGP SIGNATURE- ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [SQL] virus warning
The world rejoiced as [EMAIL PROTECTED] (Richard Huxton) wrote: I've been getting something similar myself. Roughly 100 per day. Only 100, eh? I have been seeing that many per hour, give or take... If it will help someone, I found that The Microsoft Virus is called "Swen" or "Gibe". It attacks (as usual) Internet Explorer without proper patches. Regards, Tomasz Myrta ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
[SQL] Problem with timestamp - Pls help
Dear Friends, I am using Postgres 7.3.4 on Linux server 7.3. I wanted to update one column of my table with now() or timestamp. And I want that timestamp of format 2003-09-19 18:39:08.13 To achieve this I have used the following wats=# select now(); now-- 2003-09-19 18:39:58.62398+00(1 row) wats=# select substr(now(),1,22); substr 2003-09-19 18:40:01.25(1 row) wats=# select timestamp(substr(now(),1,22));ERROR: parser: parse error at or near "substr" at character 18wats=# select to_timestamp(substr(now(),1,22));ERROR: Function to_timestamp(text) does not exist Unable to identify a function that satisfies the given argument types You may need to add explicit typecastswats=# select date(substr(now(),1,22)); date 2003-09-19(1 row) Also I cant directly update my timestamp column as follows update "WATS".users set to_rec_modified_date = substr(now(),1,22); ERROR: column "rec_modified_date" is of type timestamp without time zone but _expression_ is of type text You will need to rewrite or cast the _expression_ Please help me with this. Regards Senthil Kumar S
Re: [SQL] Problem with timestamp - Pls help
Dear Friends, I am using Postgres 7.3.4 on Linux server 7.3. I wanted to update one column of my table with now() or timestamp. And I want that timestamp of format 2003-09-19 18:39:08.13 To achieve this I have used the following wats=# select now(); now -- 2003-09-19 18:39:58.62398+00 (1 row) wats=# select substr(now(),1,22); substr 2003-09-19 18:40:01.25 (1 row) wats=# select timestamp(substr(now(),1,22)); ERROR: parser: parse error at or near "substr" at character 18 select substr(now(),1,22)::timestamp or select cast(substr(now(),1,22) as timestamp) Also I cant directly update my timestamp column as follows update "WATS".users set to_rec_modified_date = substr(now(),1,22); ERROR: column "rec_modified_date" is of type timestamp without time zone but expression is of type text You will need to rewrite or cast the expression Use syntax above. Regards, Tomasz Myrta ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
[SQL] restoring dbschema
I have a database created with pg 7.3.1 In pgAdminII I have saved the DBSchema After creating a new database in pgAdmin I opened a SQL box and loaded the dbschema.sql file and tried to run it. A number of errors occured. The first was that the public namespace was already defined this was followed by:pgSQL language not defined properly, and a number of view already defined and other errors. I worked through the batch file and eventually re-created all objects but am puzzled as to why it is not a clean operation. Is their another way I should be running this file? Thanks. Richard
Re: [SQL] Backup of multiple tables
On Fri, Sep 19, 2003 at 01:54:01PM +0200, Andreas Joseph Krogh wrote: > I usually backup my database with pg_backup without the -t option. But now I > need to only backup certain tables(say tab1 and tab2), is this possible with > pg_dump? I've tried with "pg_dump -t tab1 -t tab2" without success. Here's a perl script I used to dump all the tables separately. I'm not sure most of options do work there, I didn't test ;-) It won't be hard to make it dump certain tables, I think. -- Fduch M. Pravking dump.pl Description: Perl program ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
Re: [SQL] Backup of multiple tables
On Fri, Sep 19, 2003 at 04:30:57PM +0200, Andreas Joseph Krogh wrote: > > Here's a perl script I used to dump all the tables separately. > > I'm not sure most of options do work there, I didn't test ;-) > > It won't be hard to make it dump certain tables, I think. > > Thanks for your suggestion, but the problem with it is that I may end up with > inconsistencies if data is inserted/updated or deleted in one of the tables > during the backup, so I would miss the "snapshot"-effect. You can try to explicitly lock all tables being dumped from the script before and release them after dump is complete... But there could be dead-lock conditions. What will gurus say? -- Fduch M. Pravking ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] Backup of multiple tables
Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > I usually backup my database with pg_backup without the -t option. But now I > need to only backup certain tables(say tab1 and tab2), is this possible with > pg_dump? I've tried with "pg_dump -t tab1 -t tab2" without success. pg_dump can only handle one -t option at a time. It'd make sense to allow multiple -t options (likewise -n) but no one's got round to improving the code in that particular direction. I don't think it would be hard; want to fix it and send in a patch? regards, tom lane ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [SQL] Problem with timestamp - Pls help
On Fri, 19 Sep 2003, Kumar wrote: > Dear Friends, > > I am using Postgres 7.3.4 on Linux server 7.3. > > I wanted to update one column of my table with now() or timestamp. And I want that > timestamp of format > 2003-09-19 18:39:08.13 I think select CAST(CURRENT_TIMESTAMP(0) AS timestamp without time zone) may get you what you want without having to rely on the text format. ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [SQL] Problem with timestamp - Pls help
"Kumar" <[EMAIL PROTECTED]> writes: > I wanted to update one column of my table with now() or timestamp. And I wa= > nt that timestamp of format > 2003-09-19 18:39:08.13 It sounds like you simply want to limit the fractional precision of the value. Why don't you just declare the column as timestamp(2) ? All this fooling around with substrings is inefficient and doesn't have much to do with your real intent anyhow. regards, tom lane ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
Re: [SQL] virus warning
On Fri, 19 Sep 2003, Paul Thomas wrote: > > On 19/09/2003 07:17 Tomasz Myrta wrote: > > Hi > > Recently I receive massive mail attack. This attack comes from some > > postgresql mailing list users. All send-to adresses are taken from users > > mailboxes which contain postgresql posts. Currently I found two kinds of > > viruses: > > 1. Empty post with "Undelivered message to..." body > > 2. Microsoft "Dear Customer... " based on www.microsoft.com design. > > Both mails contains some .exe attachement. > > > > Regards, > > Tomasz Myrta > > So far I've had nearly 150 of these in the last 12 hours or so. Somebody > on these lists has a lot of explaining to do! Fortunately my spam filters > are up to scratch and I run Linux :) Others may not be so lucky. Keep in mind, if you check the headers on the emails you'll see that they are forged. I've been getting about 20 emails a day telling me a message I know I didn't send was infected with a virus. I got 432 last night inbound, some with names forged from this list, others from names unknown. But I don't think it's not the folks on this list, I think it's a windows worm that looks in people's email, harvests names at random, and forged email based on it. ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [SQL] Problem with timestamp - Pls help
On Fri, 19 Sep 2003, Stephan Szabo wrote: > On Fri, 19 Sep 2003, Kumar wrote: > > > Dear Friends, > > > > I am using Postgres 7.3.4 on Linux server 7.3. > > > > I wanted to update one column of my table with now() or timestamp. And I want that > > timestamp of format > > > 2003-09-19 18:39:08.13 > > I think select CAST(CURRENT_TIMESTAMP(0) AS timestamp without time zone) I meant (2) above. ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [SQL] Problem with timestamp - Pls help
Stephan Szabo <[EMAIL PROTECTED]> writes: > I think select CAST(CURRENT_TIMESTAMP(0) AS timestamp without time zone) > may get you what you want without having to rely on the text format. If you don't want the time zone, there's also LOCALTIMESTAMP(n). See http://www.postgresql.org/docs/7.3/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT regards, tom lane ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
[SQL] psql output and password Qs
Hi, 1) When psql is run from a script, how would one save *all* output generated by psql (including errors, info messages, etc) in to a file?. I tried redirecting output with ">" but that did not save error/confirmation messages. 2) When psql is run from a script, how would one pass a password to psql? Thanks __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [SQL] psql output and password Qs
On Fri, 2003-09-19 at 19:47, ow wrote: > Hi, > > 1) When psql is run from a script, how would one save *all* output generated by > psql (including errors, info messages, etc) in to a file?. I tried redirecting > output with ">" but that did not save error/confirmation messages. Standard output and standard error are different streams. The normal way to do what you want (Bourne shell syntax) is: psql ... >outfile 2>&1 > 2) When psql is run from a script, how would one pass a password to psql? Create a .pgpass file to read it from (see the manual for details). -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C "Bring ye all the tithes into the storehouse, that there may be meat in mine house, and prove me now herewith, saith the LORD of hosts, if I will not open you the windows of heaven, and pour you out a blessing, that there shall not be room enough to receive it." Malachi 3:10 ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [SQL] virus warning
On 19/09/2003 16:37 scott.marlowe wrote: Keep in mind, if you check the headers on the emails you'll see that they are forged. I've been getting about 20 emails a day telling me a message I know I didn't send was infected with a virus. I got 432 last night inbound, some with names forged from this list, others from names unknown. But I don't think it's not the folks on this list, I think it's a windows worm that looks in people's email, harvests names at random, and forged email based on it. Does seem to be. Just download another 200+. Mildly anoying for me with a DSL line. I really feel for those on dial-up :( -- Paul Thomas +--+-+ | Thomas Micro Systems Limited | Software Solutions for the Smaller Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +--+-+ ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [SQL] virus warning
Thank god that I use Pine. Yasir On Fri, 19 Sep 2003, Paul Thomas wrote: > Date: Fri, 19 Sep 2003 23:14:54 +0100 > From: Paul Thomas <[EMAIL PROTECTED]> > To: "pgsql-sql @ postgresql . org" <[EMAIL PROTECTED]> > Subject: Re: [SQL] virus warning > > On 19/09/2003 16:37 scott.marlowe wrote: > > > > Keep in mind, if you check the headers on the emails you'll see that they > > > > are forged. I've been getting about 20 emails a day telling me a message > > > > I know I didn't send was infected with a virus. > > > > I got 432 last night inbound, some with names forged from this list, > > others from names unknown. > > > > But I don't think it's not the folks on this list, I think it's a > > windows worm that looks in people's email, harvests names at random, and > > forged email based on it. > > Does seem to be. Just download another 200+. Mildly anoying for me with a > DSL line. I really feel for those on dial-up :( > > -- > Paul Thomas > +--+-+ > | Thomas Micro Systems Limited | Software Solutions for the Smaller > Business | > | Computer Consultants | > http://www.thomas-micro-systems-ltd.co.uk | > +--+-+ > > ---(end of broadcast)--- > TIP 8: explain analyze is your friend > ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
[SQL] DBschema restore
An example problem...The dbschema file contains the following section ( which causes several errors)-- Function: public.today()CREATE FUNCTION public.today() RETURNS date AS 'select current_date;' LANGUAGE 'sql' VOLATILE;-- View: public.todayCREATE VIEW public.today AS SELECT today() AS today;-- Rule: _RETURNCREATE RULE "_RETURN" AS ON SELECT TO today DO INSTEAD SELECT today() AS today;-- Function: public.plpgsql_call_handler()CREATE FUNCTION public.plpgsql_call_handler() RETURNS language_handler AS 'plpgsql_call_handler' LANGUAGE 'c' VOLATILE;-- Language: plpgsqlCREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler;...Errors are(1) CREATE VIEW public.today AS SELECT today() AS today; complains a view with the same name already exists. However if I close/open pgadmin it works if executed on its own.(2) CREATE RULE "_RETURN" AS ON SELECT TO today DO INSTEAD SELECT today() AS today; will not work at all. Says a view with the same name already exists(3) -- Function: public.plpgsql_call_handler()CREATE FUNCTION public.plpgsql_call_handler() RETURNS language_handler AS 'plpgsql_call_handler' LANGUAGE 'c' VOLATILE;-- Language: plpgsqlCREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler;did not work but if i use ...CREATE FUNCTION plpgsql_call_handler () RETURNS LANGUAGE_HANDLER AS'$libdir/plpgsql' LANGUAGE C;CREATE TRUSTED PROCEDURAL LANGUAGE plpgsqlHANDLER plpgsql_call_handler; it is ok and so on it goes I have 74 functions , 128 tables and 34 views. With these and the other simular errors on the dbschema sql file I urgently need some guidance on how to fix these problems. thanks Richard
[SQL] auto_increment
How to Create auto_increment field in PostreSQL. Can I create them using Trigger.
Re: [SQL] auto_increment
On Sat, 2003-09-20 at 06:10, Muhyiddin A.M Hayat wrote: > How to Create auto_increment field in PostreSQL. > Can I create them using Trigger. Use the SERIAL datatype. See also the functions nextval(), currval() and setval(). -- Oliver Elphick[EMAIL PROTECTED] Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C "But my God shall supply all your need according to his riches in glory by Christ Jesus." Philippians 4:19 ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
[SQL] Error with functions
Hey, create or replace function sample(varchar,int) returns varchar as' declare data alias for $1; size alias for $2; begin return substr(data,(length(data)-size)+1,length(data)); end; ' language 'plpgsql'; WARNING: plpgsql: ERROR during compile of sample near line 2 ERROR: parse error at or near ";" Can any body tell me why is this error coming - Warm Regards Shÿam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003 Ph : 91-824-2451001/5 Fax : 91-824-2451050 DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.Hey,create or replace function sample(varchar,int) returns varchar as'declare data alias for $1; size alias for $2;begin return substr(data,(length(data)-size)+1,length(data));end;' language 'plpgsql'; WARNING: plpgsql: ERROR during compile of sample near line 2ERROR: parse error at or near ";"Can any body tell me why is this error coming- Warm Regards Shÿam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003 Ph : 91-824-2451001/5 Fax : 91-824-2451050 DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. ---(end of broadcast)--- TIP 8: explain analyze is your friend