Hello,
I can't figure out how to make this work, or is not possible?
In a function i would like to read a file.
The file name is determined by a value from a table.
However the COPY statement does not to accept this?
I tried various forms of adding (single)-quotes but no luck.
Anyone any ideas?
Hello,
Try this:
CREATE FUNCTION _testcreate () RETURNS text AS '
BEGIN
CREATE TABLE switch_table2 (switch_id varchar(32),
selection_name varchar(100));
RETURN ''true'';
END;
' language 'plpgsql';
SELECT _testcreate();
Result:
snlsor=# SELECT _testcreate();
_testcreate
-
Hello,
I am a bit at a loss here.
If I create a function which returns something it works fine.
If it returns opaque I get the following: ERROR: typeidTypeRelid: Invalid
type - oid = 0
What am I doing wrong ?
Thanks in advance.
Best regards,
Roelof Sondaar
dhcp=# drop function lalala();
DROP
Hello jack,
To check if a table exists you could use:
select tablename from pg_tables;
For instance:
dhcp=# select count(*) from pg_tables where tablename='dhcp_subnet';
count
---
1
(1 row)
dhcp=# select count(*) from pg_tables where tablename='dhcp_subnetaa';
count
---
0
(1
Hello,
I am battleling around to get a text field into a cidr and inet type field.
The documentation says things like CAST(val AS text) but inet and cidr does
not seem to exist.
However the following works:
dhcp=# insert into dhcp_subnet(ipaddress) values('139.122.172/18');
INSERT 46172 1
dhcp=#
Hello Blaise,
I included a script I used to build/maintain a database.
It also includes triggers and history logging.
I hope you can use it.
In the DO NOT use this part are test things which might not be correct.
Best regards,
Roelof
<>
> -Original Message-
> From: Blaise Carrupt [SMT
Hello Blaise,
The following is how I tested your question;
DROP SEQUENCE b_id_seq;
DROP TABLE b;
CREATE TABLE b (
id SERIAL,
description TEXT
);
INSERT INTO b (description) VALUES('a');
INSERT INTO b (description) VALUES('b');
SELECT * FROM b;
D