Re: [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
Really?
I got no error and select sample('nothing',3) gave mi 'ing'
What is your postgresql version?
Regards,
Tomasz Myrta
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
Re: [SQL] Error with functions
Hey,
PostgreSQL 7.3 on i686-pc-linux-gnu, compiled by GCC 2.96
But, I am getting error when I am using the alias key word.
And also when I try to create a C function for the same and excute I am getting the
following error
ERROR: Memory exhausted in AllocSetAlloc(677865842)
And, I am allocating memory using the "palloc"
-
Warm Regards
Shÿam Peri
II Floor, Punja Building,
M.G.Road,
Ballalbagh,
Mangalore-575003
Ph : 91-824-2451001/5
Fax : 91-824-2451050
Original Message--
> 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
Really?
I got no error and select sample('nothing',3) gave mi 'ing'
What is your postgresql version?
Regards,
Tomasz Myrta
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,
PostgreSQL 7.3 on i686-pc-linux-gnu, compiled by GCC 2.96But, I am getting error when I am using the alias key word. And also when I try to create a C function for the same and excute I am getting the following error
ERROR: Memory exhausted in AllocSetAlloc(677865842)
And, I am allocating memory using the "palloc"-
Warm Regards
Shÿam Peri
II Floor, Punja Building,
M.G.Road,
Ballalbagh,
Mangalore-575003
Ph : 91-824-2451001/5
Fax : 91-824-2451050
Original Message--> 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
Really?
I got no error and select sample('nothing',3) gave mi 'ing'
What is your postgresql version?
Regards,
Tomasz Myrta
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 7: don't forget to increase your free space map settings
Re: [SQL] auto_increment
Ok, but if i do rollback, the auto_increment don't roolback. How to use nextval(), currval() and setval() functions. - Original Message - From: Cavit Keskin To: 'Muhyiddin A.M Hayat' Sent: Saturday, September 20, 2003 2:15 PM Subject: RE: [SQL] auto_increment Create table tablename( id serial, .. ); Serial type is integer and autoincrement When you create this table creates automatic sequence tablename_id_seq Stored sequence last value; Try execSQL : select * from tablename_id_seq; My english is very very little and bad
Re: [SQL] auto_increment
On Saturday 20 September 2003 09:43, Muhyiddin A.M Hayat wrote:
> Ok, but if i do rollback, the auto_increment don't roolback.
It's not supposed to.
> How to use nextval(), currval() and setval() functions.
Something like:
INSERT INTO my_table(nextval('my_sequence_name'),'aaa',1);
But you'll get the same problem.
What are you trying to do with the auto-increment? If you want to guarantee
that the numbers go up in sequence and have no gaps (e.g. 1,2,3,4,5 NOT
1,2,4,6) then you'll need to do some more work.
Think about what you want to have happen when three clients insert rows at the
same time and one rolls back. Once you've decided what you want, ask again if
you need some help.
--
Richard Huxton
Archonet Ltd
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] auto_increment
Where/How can i put this below sql statement, to set value of
guest_guest_id_seq before i do insert to table
SELECT setval('guest_guest_id_seq', max(guest.guest_id)) FROM guest;
i have been try
CREATE TRIGGER "before_insert_guest_update_room_number" BEFORE INSERT
ON "public"."guest" FOR EACH ROW
EXECUTE PROCEDURE "public"."generate_guest_id"();
but error
- Original Message -
From: "Richard Huxton" <[EMAIL PROTECTED]>
To: "Muhyiddin A.M Hayat" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, September 20, 2003 6:05 PM
Subject: Re: [SQL] auto_increment
> On Saturday 20 September 2003 09:43, Muhyiddin A.M Hayat wrote:
> > Ok, but if i do rollback, the auto_increment don't roolback.
>
> It's not supposed to.
>
> > How to use nextval(), currval() and setval() functions.
>
> Something like:
> INSERT INTO my_table(nextval('my_sequence_name'),'aaa',1);
> But you'll get the same problem.
>
> What are you trying to do with the auto-increment? If you want to
guarantee
> that the numbers go up in sequence and have no gaps (e.g. 1,2,3,4,5 NOT
> 1,2,4,6) then you'll need to do some more work.
>
> Think about what you want to have happen when three clients insert rows at
the
> same time and one rolls back. Once you've decided what you want, ask again
if
> you need some help.
>
> --
> Richard Huxton
> Archonet Ltd
>
> ---(end of broadcast)---
> TIP 4: Don't 'kill -9' the postmaster
>
---(end of broadcast)---
TIP 6: Have you searched our list archives?
http://archives.postgresql.org
Re: [SQL] auto_increment
El Sáb 20 Sep 2003 03:23, Oliver Elphick escribió: > 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(). Also to add, the auto increment is done through sequences. I would suggest seeing the docs on SEQUENCE, and SERIAL data type. -- Porqué usar una base de datos relacional cualquiera, si podés usar PostgreSQL? - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral - ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [SQL] auto_increment
Why do you want it to rollback? El Sáb 20 Sep 2003 05:43, Muhyiddin A.M Hayat escribió: > Ok, but if i do rollback, the auto_increment don't roolback. > How to use nextval(), currval() and setval() functions. > > - Original Message - > From: Cavit Keskin > To: 'Muhyiddin A.M Hayat' > Sent: Saturday, September 20, 2003 2:15 PM > Subject: RE: [SQL] auto_increment > > > Create table tablename( > > id serial, > > > > ); -- Porqué usar una base de datos relacional cualquiera, si podés usar PostgreSQL? - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral - ---(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] Error with functions
5:08p Dear All, When I am executing any function with parameter.. I am unable to access them. So, I would be thankful if, anyone can help me in teaching this aspect. CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' BEGIN RETURN $1 + 1; END; ' LANGUAGE 'plpgsql'; The expected ouput of the above function should be 11 when we pass the 10 to it but it returns 1. Thank you in advance - Warm Regards Shÿam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003 Ph : 91-824-2451001/5 Fax : 91-824-2451050 Original Message-- [EMAIL PROTECTED] a écrit : >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 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.* > > > > >---(end of broadcast)--- >TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] > > Hi, I juste did a copy/paste of your sample on my test DB. I didn't get any error message and the function works fine. I run PostgreSQL 7.3.3 -- Jean-Michel Chabanne 77450 MONTRY (FRANCE) 48" 54' N - 2" 49' E Powered by Linux 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.5:08pDear All,When I am executing any function with parameter.. I am unable to access them. So, I would be thankful if, anyone can help me in teaching this aspect.CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' BEGIN RETURN $1 + 1; END;' LANGUAGE 'plpgsql'; The expected ouput of the above function should be 11 when we pass the 10 to it but it returns 1.Thank you in advance- Warm Regards Shÿam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003 Ph : 91-824-2451001/5 Fax : 91-824-2451050 Original Message--[EMAIL PROTECTED] a écrit : >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 t
Re: [SQL] auto_increment
On Saturday 20 September 2003 11:14, Muhyiddin A.M Hayat wrote:
> Where/How can i put this below sql statement, to set value of
> guest_guest_id_seq before i do insert to table
> SELECT setval('guest_guest_id_seq', max(guest.guest_id)) FROM guest;
>
> i have been try
>
> CREATE TRIGGER "before_insert_guest_update_room_number" BEFORE INSERT
> ON "public"."guest" FOR EACH ROW
> EXECUTE PROCEDURE "public"."generate_guest_id"();
>
> but error
The whole idea of sequences is that you don't need to keep altering them.
Usual usage would be something like:
INSERT INTO guest (guest_id, room_number)
VALUES (nextval('guest_guest_id_seq'), 123);
Or, if you have defined guest_id as a SERIAL (which just sets DEFAULT to the
nextval() call for you).
INSERT INTO guest (guest_id, room_number)
VALUES (DEFAULT, 123);
or
INSERT INTO guest (room_number)
VALUES (123);
So long as you always use the sequence, then guest_id will get a different
number each time.
If you already have some entries in guest, and create the sequence later, then
before you start you'll want to call setval(), but you'll only need to do
this once, to skip the numbers you have already used.
Does that make it clearer?
--
Richard Huxton
Archonet Ltd
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
[SQL] sub query
Hi again I have this problem when I try to run this query, how can I rewrite it for it to work. SELECT o.item_order_num,SUM(o.item_quantity + o.item_product_id) As total, o.item_status FROM soko_product p, soko_ordered_item o WHERE p.product_id = o.item_product_id GROUP BY o.item_order_num ORDER BY o.item_order_num; Error: Attribute o.item_status must be GROUPED OR USE IN an aggregate function Please do advice thanks again Kind regards +-+ | Martin W. Kuria (Mr.) [EMAIL PROTECTED] ++ From: Christoph Haller <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [SQL] sub query Date: Wed, 17 Sep 2003 10:54:49 +0200 > > > Hi I have this problem, when I try to run this query: > > > > SELECT MAX(d), host_position FROM (SELECT host_position, > > COUNT(host_position) as d FROM sss_host GROUP BY host_position) as e; > > > > am getting and ERROR: Attribute e.host_position must be GROUPed or > used in > > an aggregate function. > > > > Please to advice what could be the problem and how can I rewrite it to > work > > thanks in advance. > > > As the error message says: e.host_position must be GROUPed > > so (supposing you want a one row result showing the maximum count) > > SELECT MAX(e.d), e.host_position FROM (SELECT host_position, > COUNT(host_position) as d FROM sss_host GROUP BY host_position) as e > GROUP BY e.host_position ORDER BY 1 LIMIT 1; > > should match your intentions. > Just thought about another (less complex) way: SELECT COUNT(host_position), host_position FROM sss_host GROUP BY host_position ORDER BY 1 DESC LIMIT 1; Regards, Christoph ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly _ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [SQL] auto_increment
In the last exciting episode, [EMAIL PROTECTED] ("Muhyiddin A.M Hayat") wrote:
> Ok, but if i do rollback, the auto_increment don't roolback.
Right, it's not supposed to.
Think about the situation where you have 5 clients connecting to the
database and adding records to this table.
The current functionality of sequences means that with a little
cacheing of values, they can all be hammering the table with inserts
and never need to worry about what the other is doing.
If the increment was rolling back by one when an INSERT was rolled
back, that would mean that the cache size was just 1, and access to
that sequence would have to be serialized across all accessors, which
would slow it down incredibly.
--
(format nil "[EMAIL PROTECTED]" "cbbrowne" "ntlug.org")
http://www3.sympatico.ca/cbbrowne/oses.html
"Let me blow that up a bit more for you."
-- Colin Powell, Discussing a picture of the intelligence compound in
Iraq
---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings
Re: [SQL] sub query
Martin Kuria writes: > Hi again I have this problem when I try to run this query, how can I rewrite > it for it to work. > > SELECT o.item_order_num,SUM(o.item_quantity + o.item_product_id) As total, > o.item_status > FROM soko_product p, soko_ordered_item o > WHERE p.product_id = o.item_product_id > GROUP BY o.item_order_num > ORDER BY o.item_order_num; > > Error: Attribute o.item_status must be GROUPED OR USE IN an aggregate > function Add o.item_status to the GROUP BY clause. -- Peter Eisentraut [EMAIL PROTECTED] ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] [ADMIN] Error with functions
[EMAIL PROTECTED] writes: > CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' > BEGIN > RETURN $1 + 1; > END; > ' LANGUAGE 'plpgsql'; > The expected ouput of the above function should be 11 when we pass the 10 t= > o it but it returns 1. Works fine for me: regression=# CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' regression'# BEGIN regression'# RETURN $1 + 1; regression'# END; regression'# ' LANGUAGE 'plpgsql'; CREATE FUNCTION regression=# select add_one(10); add_one - 11 (1 row) Perhaps you should show us exactly what you did. regards, tom lane ---(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] Automated Backup
>
>> Is there a way to automate the backup databases using pg_dump (like
>> in SQL server)?
>
Ha! Why would you want to do ANYTHING "like in SQL server"! ;)
You can do you back-ups very nicely using cron and a bash script:
bash-2.05a$ crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.22116 installed on Fri Jun 13 10:41:06 2003)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
11 02 * * 1-6 /usr/local/bin/dump paid [EMAIL PROTECTED]
Slightly edited, but illustrates the point:
bash-2.05a$ cat /usr/local/bin/dump
#!/bin/bash
# Script to dump a PostgreSQL database, producing
# compressed tar file containing with pg_dump output.
# Author: Berend M. Tober
# Date: August 25, 2003
if [ "${1}" = "" ]
then
echo "Must specify database name"
exit 0
fi
# setup variables
NAIL=/usr/local/bin/nail
PG_DUMP=/usr/bin/pg_dump
TAR=/bin/tar
DBNAME=${1}
UNAME=postgres
TARGET_EMAIL=${2}
OUTPUT_FILE=${DBNAME}.`date +%Y%m%d`
# create dump file
${PG_DUMP} -Fc -U ${UNAME} ${DBNAME} > ~/${OUTPUT_FILE}.dump
# create compressed archive of dump (and other) files
${TAR} -czf ~/${OUTPUT_FILE}.tar.gz ${OUTPUT_FILE}.dump
# above line uses tar rather than just gzip
# because in reality other files are included in
# my backup archive but which have been omitted
# in this mailing list post for simplicity.
# optionally mail the back-up archive offsite
if [ "${2}" != "" ]
then
echo|${NAIL} -r ${UNAME} -a ~/${OUTPUT_FILE}.tar.gz -s
${OUTPUT_FILE}.tar.gz ${2}
fi
---(end of broadcast)---
TIP 8: explain analyze is your friend
Re: [SQL] auto_increment
> How to Create auto_increment field in PostreSQL. Its called the SERIAL datatype: create table test_table ( field1 serial, constraint test_table_pkey primary key (field1)); > Can I create them using Trigger. Yes, alternatively, but I'm told that is not recommended because the server source code that manages the special sequence table is highly optimized for this specific functionality. ~Berend Tober ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
[SQL] Reg: Firing Trigger when a particular column value get changed
Hi All, I have a scnerio as to fire a trigger when i update a particular column in a table. Please do help me out in getting thro this. Thanks in advance, Thilak . ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
[SQL] Unique Constraint Based on Date Range
I'm looking to apply a unique constraint to a table such that field A must be unique based on the date range from Field B to Field C. This is for a rate based service model whereby, for example, $5 is worth 1 hour of Internet access. But next week, because of increased competition, $5 is worth 2 hours of Internet access. I want to maintain a history what $5 bought during a specific period of time. create table rates ( effective_date AS timestamp, expiry_date AS timestamp, cost AS numeric (12,2), access_time AS integer (in minutes) ); So for a given cost, there may not be a record where the effective date of one record overlaps the expiry date of another (and vice versa). Example record set (effective date, expiry date, cost, access_time): 2003-01-01 | 2003-01-15 | 5.00 | 60 2003-01-15 | infinity | 5.00 | 120 2003-01-01 | infinity | 1.00 | 10 An attempt to insert another 5.00 rate effective now would fail, because a 5.00 rate exists that doesn't expire (i.e. the expiry date would have to be updated to the effective date of the new record minus 1 second). I can enforce this from the front end, but a db constraint would be great. ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [SQL] how to get decimal to date form
Okay thanks, this is how I ended up doing it:
TO_DATE(SUBSTR(TO_CHAR(rec_num,999),1,6),'0YMMDD') AS Date
Another question though...
I have a field that is of type numeric so when I want to divide it like this:
SUM(vc_elapsed_time)/60.0
postgre complains "Unable to identify an operator '/' for types 'numeric' and 'double precision' You will have to retype this query using an explicit cast".
Is the best way to resolve this to cast both numerator and denominator as float?
CAST(SUM(vc_elapsed_time) AS FLOAT)/(CAST(60.0 AS FLOAT))
This seems to work but noticeably slows down the query.
-David
Tomasz Myrta <[EMAIL PROTECTED]> wrote:
> In our postgre database is a decimal field with format YYMMDDhhmmss.99> where the 9s are random digits. I'm trying to strip off just the> YYMMDD and put it in date form.> > So far I came up with:> SUBSTR(TO_CHAR(rec_num,999),1,6) AS Date which returns YMMDD.> > For example where the rec_num is 30608124143.47069519725 the above> functions return 30608.> > I tried wrapping another TO_CHAR around it to try to format it to a> date but this seems like it's a bit much for this purpose.> > Any suggestions would be appreciated.> > -David1. replace 0 with 9 to get leading zeroes - 030608 instead of 306082. to_date('030608','YYMMDD');Regards,Tomasz Myrta
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
[SQL] Need more examples (was "session variable")
On Wed, 17 Sep 2003 17:23:05 -0400, Tom Lane wrote > [EMAIL PROTECTED] (Miko O'Sullivan) writes: > > Unfortunately in the 7.2.x version I have available, EXECUTE does not > > allow "select into". The docs suggests a technique for using a FOR > > loop to extract information from an EXECUTE, but the technique only > > works for finite set of expected variables, not for arbitrary values. > > How do you figure that? AFAICS "FOR" with a record variable as > target will cover any case that SELECT INTO could handle. Tom: I don't "figure" it, it's just all I could get from documentation and discussion that is rather sparse in concrete examples. For example, this thread includes two postings that indicate that session variables can be done, and make references to commands, but fail to actually show how to do them. The documentation is the same way. The one example for FOR loops is confusing and overly broad. It fail to step through the example code clearly showing where a value from a temp table is extracted and stored in a variable. I certainly don't mean to be critical, because PostGres is a fantastic product. However, we in the open source community need to learn that software is only as good as its documentation. Concrete examples are the heart of good technical documentation. I would go so far to say that any technical documentation w/o simple concrete examples demonstrating each point is at best a quarter as useful as it might be. I guess I should live by my own words, so for concrete examples of concrete examples, please see any of the pages in the Idocs Guide to HTML. There are links at http://www.idocs.com. -Miko Miko O'Sullivan Programmer Analyst Rescue Mission of Roanoke ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [SQL] [ADMIN] Error with functions
[EMAIL PROTECTED] a écrit : 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 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.* ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] Hi, I juste did a copy/paste of your sample on my test DB. I didn't get any error message and the function works fine. I run PostgreSQL 7.3.3 -- Jean-Michel Chabanne 77450 MONTRY (FRANCE) 48" 54' N - 2" 49' E Powered by Linux ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
