Tagged Questions
0
votes
2answers
21 views
oracle plsql WITH statement combined with INSERT
During migration of postgresql 9 functions faced the following issue:
in Oracle you can use WITH just in complex select statements. Meanwhile in postgres (and MS SQL 2008 too) you can use WITH and ...
1
vote
1answer
47 views
New to SQL - Trouble getting quarterly date output
I'm really new to sql and databases in general. Trying to teach myself the language but I'm stuck and would like to know what's wrong. So here's what I have:
1976-01-01,6.1
1976-04-01,5.7
...
1
vote
3answers
53 views
Ignoring errors in concurrent insertions
I have a string vector data containing items that I want to insert into a table named foos. It's possible that some of the elements in data already exist in the table, so I must watch out for those.
...
3
votes
1answer
695 views
Passing a record as function argument PL/pgSQL
First I am really new to pl/pgsql. Need it for a project.
I am stuck with this (simplified) problem.
My db schema has a n to m relationship (author, books, author_books)
Now I want to have a ...
1
vote
2answers
45 views
Inserting data from one table(triplestore) to another(property table)
I have a to transfer RDF data from a triplestore to property tables. Example of a triple store and a property table is given below.
triplestore
Subject Property Object
Sub1 prop1 hello
Sub2 ...
2
votes
1answer
111 views
Cannot insert NULL values into database
We use JPA to load/persist our entities in a prostges database. In one case i must persist a entity with a native query. Heres is the code:
String sql = "INSERT INTO recording ...
0
votes
1answer
101 views
Inserting in postgresql table from db2 trigger
My problem is the following one:
I have a db2 database and a postgres database. They are in different servers. Every time i add a new record into a db2 table, it should be added immediately to the ...
1
vote
2answers
28 views
Use RETURNING without explicitly naming the columns
I have a table with more than a few columns and want to return the id from the INSERT query using RETURNING. Unfortunately it seems that in this case I have to specify ALL columns
INSERT INTO "user" ...
1
vote
2answers
56 views
Can I use INSERT inside CASE in postgres
I am trying to create a function in postgres that would insert a row if it doesn't exist and return the row's id (newly created or existing).
I came up with this:
CREATE OR REPLACE FUNCTION ...
0
votes
1answer
1k views
Postgres LEFT JOIN is creating more rows than in left table
I am running Postgres 9.1.3 32-bit on Windows 7 x64. (Have to use 32 bit because there is no Windows PostGIS release compatible with 64 bit Postgres.) (EDIT: As of PostGIS 2.0, it is compatible with ...
0
votes
3answers
67 views
INSERT while LOOPing
i'd like to insert some records into a table while looping. Records are passed as a varchar tab to a function ie.:
create function a(tab varchar[]) RETURNS void AS
$$
DECLARE
b varchar(20);
BEGIN
...
1
vote
2answers
90 views
Returning records inserted by plpgsql function
I have a cron job that executes a plpgsql function in postgres. This function inserts zero to many records into table. What's the best way to also return the records that have been created by the ...
3
votes
4answers
1k views
Return id if a row exists, INSERT otherwise
I'm writing a function in node.js to query a PostgreSQL table.
If the row exists, I want to return the id column from the row.
If it doesn't exist, I want to insert it and return the id (insert into ...
0
votes
1answer
92 views
Convert SQL-Server specific INSERT query to PostgreSQL
I have a SQL Server 2008 specific query how can I execute same query in PostgreSQL.
INSERT INTO profile_answers_new (pro_ans_frn_pro_id, pro_ans_name)
SELECT pro_ans_frn_pro_id = @new_pro_id , ...
0
votes
1answer
75 views
Lazarus + PostgreSQL: Why do blank textboxes get stored with single speech marks?
The language used is Lazarus Pascal and the DB is PostgreSQL.
I'm assigning values into parameters like this:
dbQuery_Supp.Params.ParamByName('pCity').AsString := txtCity.Text;
And this is written ...