You could use your own type, since it seems you know what values you'll be storing there. You can create it like this:
CREATE TYPE MyResult AS (
dt_inici DATE,
dt_fi DATE
);
Then you must change your functions as follows:
CREATE OR REPLACE FUNCTION test1() RETURNS MyResult AS '
decl
You could use your own type, since it seems you know what values you'll be storing there. You can create it like this:
CREATE TYPE MyResult AS (
dt_inici DATE,
dt_fi DATE
);
Then you must change your functions as follows:
CREATE OR REPLACE FUNCTION test1() RETURNS MyResult AS '
decl
ot;postgresql_command stop"restart_cmd="postgresql_command restart"
reload_cmd="postgresql_command reload"status_cmd="postgresql_command status"initdb_cmd="postgresql_initdb"postgresql_command(){su -l ${postgresql_user} -c "exec ${comman
This is not a PostgreSQL problem, it's the script you are using for
startup that has some problem. The pg_hba method is for connection
stablishment. PostgreSQL will start no matter what you put there.
Startup scripts are usually run as root, and postgresql script should su
to the postgresql user t
Si necesitás una lista en español, podés ir a
http://archives.postgresql.org/pgsql-es-ayuda y suscribirte, los
suscriptores de esta lista hablan inglés y no te va a resultar fácil
conseguir ayuda :(
El tipo de datos que buscas se llama SERIAL (http://www.postgresql.org/docs/8.0/interactive/datatyp
You could add a TIMESTAMP field on the three tables (lets call it last_change), and modify your triggers to update this value every time a row is updated.
Then your trigger should update the boolean fields with the boolean
value of the row with the max(last_change) in the three tables, only if the
just obtain the next value from the sequence first, then do the insert:
CREATE OR REPLACE FUNCTION insert_row(text) returns text language plpgsql
AS $$
DECLARE
vdesc alias for $1;
new_id INTEGER;
BEGIN
SELECT nextval('sequence_name_here') INTO new_id;
INSERT INTO productos (id,
You could write a trigger like this:
CREATE OR REPLACE FUNCTION checkDate() RETURNS TRIGGER LANGUAGE 'plpgsql' AS '
DECLARE
limitDate DATE DEFAULT current_date-''1 year''::INTERVAL;
BEGIN
IF (OLD.date<=limitDate) THEN
RAISE EXCEPTION ''Cannot change record.'';
END IF;
RETURN NEW;
END;
';
C
You can order by conditions, lets say column='Unit'. The evaluation of
a conditions will give you 't' or 'f', and alfabetically 'f' <
't'... you should use DESC to get the matches first. So, it would be
more or less like this:
ORDER BY
column='Unit' DESC,
column='Exterior' DESC,
column='C
It's easy. You have to know that INTERVAL data type exist, so:
SELECT current_date - '30 days'::interval
SELECT current_timestamp - '1 hour'::interval
2005/5/3, Craig Bryden <[EMAIL PROTECTED]>:
HiHow in postgres can I do date/time subtraction or addition.e.g. If I want to get today's date - 30 d
something == otherthing is a boolean expression, you are asking the
database to compare both values, u.color_id is not equal c.color_name,
that's why you get 'f'.
I guess that you want to replace the color_id from users by the
corresponding color_name from colors:
SELECT
c.color_name, u.nam
I think the best way would be not to use a SERIAL field, but an INTEGER
field and a sequence:
CREATE SEQUENCE parent_seq;
CREATE TABLE parent(id INTEGER, descrip CHAR(50));
So when you want to insert on the parent table, you obtain the next
value from the sequence and then you insert in the pare
I've tested it, and the SERIAL type populates the column when you add it
On Sat, 2004-11-06 at 18:56, Ed L. wrote:
On Saturday November 6 2004 2:13, Franco Bruno Borghesi wrote:
> the simplest way to do it seems to be adding a SERIAL column to your
> table, and then adding a
the simplest way to do it seems to be adding a SERIAL column to your table, and then adding a primary key constraint:
1)insert data into table
2)ALTER TABLE ADD id SERIAL;
3)ALTER TABLE ADD CONSTRAINT _pk PRIMARY KEY (id);
you can check the docs for the SERIAL type: http://www.postgresql.or
You could create your own function for the conversion, something like:
CREATE OR REPLACE FUNCTION interval2Months(INTERVAL) RETURNS INTEGER LANGUAGE 'sql' IMMUTABLE AS '
SELECT CAST(extract(YEAR FROM $1) * 12 + extract (MONTH FROM $1) AS INTEGER);
';
you call it doing SELECT interval2Months(
I've made a test case, and setting the trigger BEFORE DELETE doesn't delete the rows from the table (but it does execute the trigger, and it does insert the rows in the audit table), I dont' know why .
Anyway, setting the trigger AFTER DELETE works ok.
On Mon, 2004-10-25 at 15:56, Naeem Bari
This is the way you do it in postgreSQL:
UPDATE
test
SET
code=T2.code
FROM
test T2
WHERE
test.code=0 AND
test.master=T2.name;
you need to specify the join condition in the WHERE clause.
On Tue, 2004-08-10 at 00:34, Igor Kryltsov wrote:
Hi,
If you can help me to correct my
CREATE DOMAIN is the answer:
CREATE DOMAIN mytype AS INT2 CHECK(VALUE>=1 AND VALUE<=6);
On Mon, 2004-07-19 at 10:43, [EMAIL PROTECTED] wrote:
hi,
Is it possible in Postgre to have enum type, so that later table fileld get values from 1-6 (saving space)
1 - statex
2 - stateY
3 - stateZ
so
you should check the logs, when postmaster dies right after starting it always leaves a helpfull message there.
On Wed, 2004-07-07 at 10:09, José Augusto Tovar wrote:
Hi all,
I´m using postgreSQL in WinME and i had a very strange problem. When i start
the postgres the process postmaster sta
I think you should use a cursor; you declare it, and then you fetch the rows as you need them.
On Fri, 2004-02-06 at 14:04, Christoffer Gurell wrote:
I want to create a program which displays large tables and makes this possible
over a slow connection. The problem is that when i do a PQexec t
that's great, I didn't know about the information schema... guess I never read the 'what's new' document
On Fri, 2004-02-06 at 13:15, Tom Lane wrote:
Franco Bruno Borghesi <[EMAIL PROTECTED]> writes:
> Does anyone know if the ansi sql standard defines a
this query will list every table (with its attributes) in the "public" schema. You could alter the where clause to add more schemas (maybe using IN):
SELECT
N.nspname,
C.relname,
A.attname,
pg_catalog.format_type(a.atttypid, a.atttypmod) AS typeName
FROM
pg_class C,
pg_namespace N,
pg_attribut
this should work (don't forget to replace !!!):
SELECT
A.attname,
pg_catalog.format_type(a.atttypid, a.atttypmod) AS typeName
FROM
pg_class C,
pg_attribute A,
pg_type T
WHERE
C.relname ILIKE '' AND
(C.oid=A.attrelid) AND
(T.oid=A.atttypid) AND
(A.attnum>0) AND
(NOT A.attisd
I've read this message, and tryed to apply this changes to my own database.
sapiens=# vacuum verbose;
...
INFO: free space map: 1 relations, 39 pages stored; 48 total pages needed
DETAIL: Allocated FSM size: 1000 relations + 3 pages = 237 kB shared memory.
1 relation and 48 pages seems
don't worry!! it's just a cygwin installation for a demostration application for the sales team. Real application runs on bsd
On Thu, 2003-11-20 at 11:23, Alvaro Herrera Munoz wrote:
On Thu, Nov 20, 2003 at 10:48:08AM -0300, Franco Bruno Borghesi wrote:
> The file was there, b
you need to install contrib/dbsize. Then you can do:
SELECT relation_size('myTable');
On Thu, 2003-11-20 at 02:30, K. Deepa wrote:
Hi All,
Is it possible find the size of a pgsql table.
TIA
signature.asc
Description: This is a digitally signed message part
01:45:21PM -0300, Franco Bruno Borghesi wrote:
> Hi everyone.
>
> I'm having problems with a database, I get the following errors while
> accesing it (from my application and from pg_dump)
>
> ERROR: Could not access status of transaction 65536
> DETAIL: Could not read from
I think it was delayed until 7.5... same for win32 port.
Here ir Bruce's message talkin about both topics: http://archives.postgresql.org/pgsql-hackers/2003-07/msg00284.php
On Tue, 2003-11-18 at 11:01, Rafael Martinez Guerrero wrote:
Hello
I am trying to find out when 'Point-in-time data re
the problem is
constraint id PRIMARY (id), it should be constraint id PRIMARY KEY (id).
Besides that, you will have problems with '-00-00'... month starts at 1, day starts at 1, and I don't know about year 0. Maybe this field 'time' should be NULLable, or maybe its default value should be
yes, parseTypeString() seems to be the way.
I've found parseTypeString() in plpgsql.so... would it be ok to call dlopen('plpgsql.so', ...) from my C code to access this function or is there some other method I sould use?
thanks tom.
On Mon, 2003-09-08 at 12:02, Tom Lane wrote
Hi everyone.
I need to create a C function that returns a row, and the type of this row must be the same of a type that I've created using CREATE TYPE.
I've seen the function:
TupleDesc TypeGetTupleDesc(Oid typeoid, List *colaliases)
but I don't understand two things:
1)I just know the name
Hi guys!
I need to migrate some plpgsql functions I have to C language.
These functions execute queries and process the results inside, and some of them return records... I've been reading the documentation, but I would like any of you to tell me where can I find some examples of these kind o
Besides the performance issues, I think it's correct to detect refreshes before sending data to the database.
In our applications, we ignore refreshes from the begining.
We do it by sending a serial number, which we keep on a session variable.
Every time we send a page to a client, we increme
Initial beta release of plPHP http://www.postgresql.org/news/143.html
On Tue, 2003-08-19 at 10:46, David Siebert wrote:
I learned MySQL then went on to Postgres. I chose postgres for my in
house project just because of the row locking and transactions. Looking
back I could have used MySQL.
my old brain.
>>I will try to by more unequivocal this time :)
>>
>>Shridhar Daithankar wrote:
>> > select oid,name from a;
>>I know it, but i have to have not oid's but row numbers :) such like :
>> table "test"
>> offset | value
>>---
Maybe the best option (specialy if you need users to control the jobs) would be to create a table like this:
CREATE TABLE batchjobs (
id SERIAL,
sql TEXT NOT NULL,
done BOOLEAN NOT NOOL DEFAULT false
);
Then you create a pl/pgsql function that iterates every "undone" record from this
and what about boolean attirbutes in where clauses? Is any difference between
-SELECT ... WHERE boolean_field
and
-SELECT ... WHERE boolean_field=true
?
On Wed, 2003-07-23 at 11:48, Tom Lane wrote:
Franco Bruno Borghesi <[EMAIL PROTECTED]> writes:
> This makes me wonder, what
I always use Steve's method (it's easier), but if you still want to do it in the sql-server way, you can use OIDs to fetch the id of the last INSERTed row.
I don't know which programming language you are using, but are some examples:
*plpgsql
DECLARE
myOid INTEGER;
identity
38 matches
Mail list logo