shopsuite-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Shopsuite-dev] rational numbers plugin to pg


From: Davi Leal
Subject: Re: [Shopsuite-dev] rational numbers plugin to pg
Date: Mon, 06 Aug 2001 12:50:27 +0100

> I will check this plug-in today. I will think about how modify the
> shop.psql script (later the ShopDB class). I will send to this list a
> proposal so as to get your opinion.


See the shop.psql attachment. When I try:

$ dropdb shop
$ createdb shop

# su postgres
$ psql shop < _RatePlugin_/rational.sql
(I use the last rational.so version)

address@hidden:~$ psql shop <  shopsuite/scripts/shop.psql
All right!. And it works. See below:

shop=> INSERT INTO products VALUES ('shortdsc', 'longdsc', 12345678.1234,
'1345/235', 'bottle', TRUE);
INSERT 61129 1
shop=> select * from products;
  shortdsc   | longdsc |  sellprice  |  stock   |         unit         |
active | prodid
-------------+---------+-------------+----------+----------------------+--------+--------

 shortdsc    | longdsc | 12345678.12 | 1345/235 | bottle               |
t      |      1
(1 row)



However, without rebutting the machine I do now:

$ dropdb shop
DROP DATABASE
$
$ createdb shop
CREATE DATABASE
$
$ psql shop <  shopsuite/scripts/shop.psql
ERROR:  Unable to locate type name 'rational' in catalog
[...]

It seems that the rational type load only works while the session where it was
loaded is open. What do you think about it?.


Platform: Debian GNU/Linux 'woody' updated today.


P.S.: What do you think about the new shop.psql script?. Is it right?. Are we
ready to carry out the ShopDB class changes?.
CREATE TABLE products (
        shortdsc        char(11),
        longdsc         text,
        sellprice       numeric(11,2),
        stock           rational,
        unit            char(20),
        active          bool,
        prodid          serial
);
CREATE TABLE measurementunits (
        unit            char(20)
);


CREATE TABLE transform (
        prodid_out      int NOT NULL,
        notes           text,
        active          bool,
        transformid     serial
);
CREATE TABLE transform_ingredient (
        transformid     int NOT NULL,
        prodid_in       int NOT NULL,
        rate            rational
);
CREATE TABLE transform_history (
        transformid     int,
        inactivation    timestamp
);
CREATE TABLE howtomake_ingredient (
        prodid_out      int NOT NULL,
        prodid_in       int NOT NULL,
        rate            rational
);


CREATE TABLE deviationtype (
        shortdsc        char(16),
        longdsc         text,
        devid           serial
);
CREATE TABLE operations (
        t               timestamp,
        notes           text,
        userid          char(20),
        opid            serial
);
CREATE TABLE tradehistory (
        opid            int,
        prodid          int,
        amount          rational,
        price           numeric(11,2)
);
CREATE TABLE inventorydeviation (
        opid            int,
        devid           int,
        prodid          int,
        diff            rational
);


CREATE VIEW ProdsToSell
AS SELECT
        shortdsc,
        longdsc,
        sellprice,
        unit,
        prodid
FROM products
WHERE   active AND sellprice IS NOT NULL;

CREATE VIEW ProdsToBuy
AS SELECT
        shortdsc,
        longdsc,
        stock,
        unit,
        prodid
FROM products
WHERE   active AND prodid NOT IN (SELECT prodid_out FROM transform);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]