Skip site navigation (1) Skip section navigation (2)

Re: funny (cache (?)) bug in postgres (7.x tested)

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: RISKO Gergely <risko(at)atom(dot)hu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: funny (cache (?)) bug in postgres (7.x tested)
Date: 2001-07-03 21:03:57
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
RISKO Gergely wrote:
[Charset iso-8859-1,iso- unsupported, skipping...]

> Hello!
> I found a funny bug in postgres with c functions. (or feature??)
> Let's say we have got an function like this:
> CREATE FUNCTION hupper(text)
> RETURNS text
> AS '/'

    This  is  actually  neither a feature, nor a bug in Postgres.
    Your function is violating some coding rules.

    The text argument handed into is actually residing inside the
    shared buffer cache. So you're not supposed to change it!

    Your function isn't safe for compressed or toasted values. If
    you accidentially have big data  in  that  column,  it  might
    crash the backend completely.

    A  function  returning  text has to allocate the return value
    with palloc().

    Look into utils/adt/*.c for examples how  to  deal  correctly
    with text attributes.



# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck(at)Yahoo(dot)com #

Do You Yahoo!?
Get your free address at

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2001-07-03 21:11:46
Subject: Re: Buffer access rules, and a probable bug
Previous:From: Alex PilosovDate: 2001-07-03 20:32:21
Subject: Re: New SQL Datatype RECURRINGCHAR

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group