On Thu, Jun 29, 2017 at 1:36 PM, Rich Shepard
wrote:
> On Thu, 29 Jun 2017, Cachique wrote:
>
> That is correct. You can double the single quotes. Another way is to use
>> the E'...' syntax (i.e., E'O\'Brien'). Or you can use the quote_*
>> functions (
>> https://www.postgresql.org/docs/current/s
On Thu, 29 Jun 2017, Cachique wrote:
That is correct. You can double the single quotes. Another way is to use
the E'...' syntax (i.e., E'O\'Brien'). Or you can use the quote_*
functions (
https://www.postgresql.org/docs/current/static/functions-string.html)
Walter,
Thanks for confirming.
R
The syntax for inserting data into a table uses single quotes to identify
strings. When I have a string such as O'Brien do I double the single quotes
within the string (i.e., 'O''Brien') or is there another way to include such
strings?
Rich
--
Sent via pgsql-general mailing list (pgsql-gener
This topic came up before
http://archives.postgresql.org/pgsql-general/2010-12/msg00542.php
and there was some discussion on how-to.
Briefly, the table is partitioned and there is an id column declared as
id bigint DEFAULT nextval('history_id_seq'::regclass) NOT NULL
and the application
> On 2010-12-16, pgsql(dot)30(dot)miller_2555(at)spamgourmet(dot)com
> wrote:
> > --0015174c1e4aaf077604977d7e62
> > Content-Type: text/plain; charset=ISO-8859-1
> >
> > Hi -
> >
> > Issue:
> > How to return a sequence value generated upon INSERT of records into a
> > partitioned table using
Hi -
Issue:
How to return a sequence value generated upon INSERT of records into a
partitioned table using trigger functions (without having to insert into the
child table directly).
Current implementation:
The master table of the partitioned table uses a trigger function to
alter an inco
>
>
> This will not work for me as I do not know in advance what columns
> exist in test_a or test_b. I only know they are called the same (and
> have the same datatypes).
>
> So is there a dynamic way in which I can generate the INSERT statement
> given the name of the two tables?
>
>
You can writ
On Mon, Mar 29, 2010 at 5:09 PM, Leif Biberg Kristensen
wrote:
> On Monday 29. March 2010 16.51.35 Ole Tange wrote:
>> I would like to do this:
>>
>> insert into test_b (select * from test_a);
>
> Per the SQL standard, there's no inherent order between columns. That said,
> you'll usually get t
On Monday 29. March 2010 16.51.35 Ole Tange wrote:
> I have 2 tables that have the same column names but in different
> order. Similar to this:
>
> create table test_a (col_a text, col_b int);
> create table test_b (col_b int, col_a text);
> insert into test_a values ('abc', 2),( 'def', 3);
I have 2 tables that have the same column names but in different
order. Similar to this:
create table test_a (col_a text, col_b int);
create table test_b (col_b int, col_a text);
insert into test_a values ('abc', 2),( 'def', 3);
I would like to do this:
insert into test_b (select * from
I have a table that has multiple partitions (1000+) and I want a trigger
or rule to be able to write data automatically to each partition. One of
the values I am inserting is the table partition name, but I'm not sure
how to use it as a variable in a trigger. All trigger examples have a
series of I
am Wed, dem 02.07.2008, um 11:58:19 +0200 mailte A B folgendes:
> What should I replace the command
>
> INSERT INTO table (name) VALUES (value) RETURNING currval('my_id_seq')
> into my_var;
>
> with if I have to use version 8.1?
select currval('my_id_seq');
Andreas
--
Andreas Kretschmer
Kont
What should I replace the command
INSERT INTO table (name) VALUES (value) RETURNING currval('my_id_seq')
into my_var;
with if I have to use version 8.1?
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref
know/care if a table is
> partitioned or not.
>
> /Mattias
>
>> -Original Message-
>> From: Magnus Hagander [mailto:[EMAIL PROTECTED]
>> Sent: den 11 juni 2008 10:43
>> To: Arbin Mattias
>> Cc: pgsql-general@postgresql.org
>> Subject: Re: [GEN
der [mailto:[EMAIL PROTECTED]
> Sent: den 11 juni 2008 10:43
> To: Arbin Mattias
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Insert into master table ->" 0 rows
> affected" -> Hibernate problems
>
> Ah, in my testing I had a single RULE without
om: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of
>> Magnus Hagander
>> Sent: den 10 juni 2008 10:43
>> To: Arbin Mattias
>> Cc: [EMAIL PROTECTED]; pgsql-general@postgresql.org
>> Subject: Re: [GENERAL] Insert into master table ->" 0 r
nt: den 10 juni 2008 10:43
> To: Arbin Mattias
> Cc: [EMAIL PROTECTED]; pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Insert into master table ->" 0 rows
> affected" -> Hibernate problems
>
> I think that if you use a RULE instead of a TRIGGER to
tt Marlowe [mailto:[EMAIL PROTECTED]
> Sent: den 5 juni 2008 02:01
> To: Arbin Mattias
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Insert into master table ->" 0 rows affected" ->
> Hibernate problems
>
> On Tue, Jun 3, 2008 at 7:38 AM, <[EM
nsert statement.
/Mattias
-Original Message-
From: Scott Marlowe [mailto:[EMAIL PROTECTED]
Sent: den 5 juni 2008 02:01
To: Arbin Mattias
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Insert into master table ->" 0 rows affected" ->
Hibernate problems
On Tue, J
On Tue, Jun 3, 2008 at 7:38 AM, <[EMAIL PROTECTED]> wrote:
> I have implemented partitioning using inheritance following the proposed
> solution here (using trigger):
> http://www.postgresql.org/docs/8.3/interactive/ddl-partitioning.html
>
> My problem is that when my Hibernate application inserts
I have implemented partitioning using inheritance following the proposed
solution here (using trigger):
http://www.postgresql.org/docs/8.3/interactive/ddl-partitioning.html
My problem is that when my Hibernate application inserts to the master
table, postgres returns "0 rows affected", which caus
I have implemented partitioning using inheritance following the proposed
solution here (using trigger):
http://www.postgresql.org/docs/8.3/interactive/ddl-partitioning.html
My problem is that when my Hibernate application inserts to the master
table, postgres returns "0 rows affected", which caus
Tore Halset wrote:
Hello.
One of our users tried a "insert into ... select ..." that gave a
strange error message. After digging into the issue, the problem seem to
be that the order of the columns in the select statement must match the
table definition. Here is a way to reproduce this case.
On Jan 15, 2008, at 12:16 , Albe Laurenz wrote:
Because the SQL standard says so.
ISO/IEC 9075-2, Chapter 14.8, Syntax Rule 9:
"If the is omitted, then an
that identifies all columns of T in the ascending sequence of
their ordinal positions within T is implicit."
You want an explicit :
I
Tore Halset wrote:
> One of our users tried a "insert into ... select ..." that gave a
> strange error message. After digging into the issue, the problem seem
> to be that the order of the columns in the select statement must match
> the table definition. Here is a way to reproduce this case.
Tore Halset wrote:
Hello.
One of our users tried a "insert into ... select ..." that gave a
strange error message. After digging into the issue, the problem seem to
be that the order of the columns in the select statement must match the
table definition. Here is a way to reproduce this case.
Hello.
One of our users tried a "insert into ... select ..." that gave a
strange error message. After digging into the issue, the problem seem
to be that the order of the columns in the select statement must match
the table definition. Here is a way to reproduce this case.
-- a source tab
On Dec 17, 2007 6:56 PM, Matthew Dennis <[EMAIL PROTECTED]> wrote:
> in 8.3beta3
>
> create table t0(c1 int);
> create table t1(c1 int);
>
> insert into t0 values (1);
> insert into t0 values (2);
> insert into t0 values (3);
>
> If I execute "delete from t0 returning *" it deletes the rows and r
in 8.3beta3
create table t0(c1 int);
create table t1(c1 int);
insert into t0 values (1);
insert into t0 values (2);
insert into t0 values (3);
If I execute "delete from t0 returning *" it deletes the rows and returns
the deleted rows. I could insert all those rows into t1 by doing "insert
into
>
"Alain Roger" <[EMAIL PROTECTED]> writes:
> i would like to understand why the following INSERT INTO statement works :
> INSERT INTO mytable
>SELECT nextval('my_sequence'),
>'myname',
>'myfirstname'
> ;
This is a perfectly standard INSERT ... SELECT query.
> whereas usually we shou
Values is optional. We support insert into select
Dave
On 9-Dec-07, at 11:05 AM, Alain Roger wrote:
Hi,
i would like to understand why the following INSERT INTO statement
works :
INSERT INTO mytable
SELECT nextval('my_sequence'),
'myname',
'myfirstname'
;
whereas usually we shou
On Dec 9, 2007, at 11:05 , Alain Roger wrote:
Hi,
i would like to understand why the following INSERT INTO statement
works :
INSERT INTO mytable
SELECT nextval('my_sequence'),
'myname',
'myfirstname'
;
whereas usually we should do :
INSERT INTO mytable
VALUES
(
SELECT nextval
Hi,
i would like to understand why the following INSERT INTO statement works :
INSERT INTO mytable
SELECT nextval('my_sequence'),
'myname',
'myfirstname'
;
whereas usually we should do :
INSERT INTO mytable
VALUES
(
SELECT nextval('my_sequence'),
'myname',
'myfirstname'
);
t
ember 13, 2006 5:01 PM
To: Brandon Aiken
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] INSERT INTO row value constructors
On Wed, Dec 13, 2006 at 04:55:00PM -0500, Brandon Aiken wrote:
> This is just an odd question. Previously RDBMSs (MySQL, SQLite, IIRC)
I've used have allo
On Wed, Dec 13, 2006 at 04:55:00PM -0500, Brandon Aiken wrote:
> This is just an odd question. Previously RDBMSs (MySQL, SQLite, IIRC) I've
> used have allowed row value constructors (optional feature F641 in SQL'03) on
> INSERT statements. That is:
>
> INSERT INTO mytable
> VALUES (0,'hello')
This is just an odd question. Previously RDBMSs (MySQL, SQLite, IIRC) I've
used have allowed row value constructors (optional feature F641 in SQL'03) on
INSERT statements. That is:
INSERT INTO mytable
VALUES (0,'hello'),(1,'world');
Is essentially shorthand for:
INSERT INTO mytable VALUES (0
""Nikola Ivanov"" <[EMAIL PROTECTED]> wrote
> Database is running on Windows 2003 Advanced Server and it is PostgreSQL
> 8.1.3.
>
> On 6/9/06, Tom Lane <[EMAIL PROTECTED]> wrote
> >
> > Buggy SysV semaphore support in the kernel, maybe? What platform is
> > this exactly?
> >
Yes, there is a bug
Database is running on Windows 2003 Advanced Server and it is PostgreSQL 8.1.3.The Java application is running from a remote machine running Windows XP Professional SP2.On 6/9/06,
Tom Lane <[EMAIL PROTECTED]> wrote:
"Qingqing Zhou" <[EMAIL PROTECTED]> writes:> A wild guess is that when we continue
"Qingqing Zhou" <[EMAIL PROTECTED]> writes:
> A wild guess is that when we continue to sleep on the semaphore, magically
> we get it, but how come?
Buggy SysV semaphore support in the kernel, maybe? What platform is
this exactly?
regards, tom lane
---
"Nik" <[EMAIL PROTECTED]> wrote
>
> I also noticed that I am having the similar issue with SELECT
> statements. Same SELECT statement will run fine 3-4 times in a row and
> then get stuck and run forever with no results. But if I reload the
> configuration like above, the query immediatelly return
I am still having the same problem. I tried to eliminate any possible
network issues by placing the application on the server itself, but the
same thing happened.
However, I had an interesting discovery today that I don't understand.
I left the insert query that was stuck running. Then, without c
I thought that since application continues running fine after I restart
it, I would try creating a separate connection for each insert
statement, and then disconnect when it's completed.
However, this had the same problem. It would connect, insert, and
disconnect several hundred times, and then at
Ok, that's a good point. I overlooked the possibility of this
considering that I didn't think the timestamp resolution was that high.
I changed my rules and constraints on tables to take care of this case.
Thanks.
However, how does this affect the problem I having considering that
inserts that wer
On Mon, May 22, 2006 at 01:38:20PM -0700, Nik wrote:
> CREATE TABLE schemaname.partition_table
> (
> CHECK("start" >= '05-01-2006 00:00:00' AND "start" <= '05-31-2006
> 23:59:59'),
What about 5-31-2006 23:59:59.3?
What you really want is:
CHECK("start" >= '05-01-2006' AND "start" < '06-01-20
I do not run the INSERTs concurrently. They are being executed as the
data comes in sequentially. I attempted to create a stand-alone example
to reproduce the issue, but I was not successful. I will post the
example anyway. This example ran fine, and did not hang at any point,
but it might give a g
I have an application that executes an INSERT statement every second or
two. In my old design this data was inserted into one table. However, I
changed the design to have one table with multiple partitions. Now when
I run the application it runs for some random amount of time (random
number of INSE
"Nik" <[EMAIL PROTECTED]> wrote
> I have an application that executes an INSERT statement every second or
> two. In my old design this data was inserted into one table. However, I
> changed the design to have one table with multiple partitions. Now when
> I run the application it runs for some ran
On Wed, May 03, 2006 at 10:02:17AM -0700, Karen Hill wrote:
>
> Tom Lane wrote:
>
> Thanks Tom,
>
> I tried it and it worked. Is it possible to do something a bit more
> complex? Can you use rules to insert into a view that has multiple
> tables as the source? For example:
>
> CREATE VIEW v
Tom Lane wrote:
> I hope it said rules, because you can't put a trigger on a view.
>
> regression=# create table t(f1 int, f2 text);
> CREATE TABLE
> regression=# create view v as select * from t;
> CREATE VIEW
> regression=# insert into v values(22, 'foo');
> ERROR: cannot insert into a view
>
"Karen Hill" <[EMAIL PROTECTED]> writes:
> Tried it but didn't work. It gave me a hint though to try triggers.
> Can anyone show me how to do an insert into a view using triggers?
I hope it said rules, because you can't put a trigger on a view.
regression=# create table t(f1 int, f2 text);
CREAT
On Mon, May 01, 2006 at 05:23:22PM -0700, Karen Hill wrote:
> Tried it but didn't work. It gave me a hint though to try triggers.
> Can anyone show me how to do an insert into a view using triggers?
Rules are probably what you're after; the documentation has examples.
http://www.postgresql.org/d
Tried it but didn't work. It gave me a hint though to try triggers.
Can anyone show me how to do an insert into a view using triggers?
Thanks. :-)
---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?
http://www.postgr
Fellows,
I've restarted postgres after installing postgresql-dev package on my
sarge debian box and that's it, I can connect to other database using
libpq. Here is my code for anyone interested in this issue. I compiled
the source code using:
gcc -fpic -shared -lpq -I/usr/include/postgresql/ser
Thanks Michael,
I'll check it out. I forgot to say to you that I'm using postgresql 7.4 that's why I can't use pl/perl.
Greetings,
Rodolfo.
On 2/8/06, Michael Fuhr <[EMAIL PROTECTED]> wrote:
[Please copy the mailing list on replies.]On Wed, Feb 08, 2006 at 06:57:11PM -0400, Rodolfo Campos wrote:
[Please copy the mailing list on replies.]
On Wed, Feb 08, 2006 at 06:57:11PM -0400, Rodolfo Campos wrote:
> When I tried to connect using libpq I got errors too. But this time the
> error is trying to register the function in postgresql, the RDBMS tells me
> that the function PQconnectdb is undef
> Hi Fellows,
>
> I'm wondering if in postgres we can insert a tuple into a table that
is
> outside of a database (I'm supossed to be connected to database1 and
want
> to insert a register into a table in database2).
>
> This question is because I want to update a tables into one database
from
>
On Wed, Feb 08, 2006 at 05:59:19PM -0400, Rodolfo Campos wrote:
> I'm wondering if in postgres we can insert a tuple into a table that is
> outside of a database (I'm supossed to be connected to database1 and want to
> insert a register into a table in database2).
You can do this with contrib/dbli
Hi Fellows,
I'm wondering if in postgres we can insert a tuple into a table that is
outside of a database (I'm supossed to be connected to database1 and
want to insert a register into a table in database2).
This question is because I want to update a tables into one database
from a trigger (writt
# [EMAIL PROTECTED] / 2005-07-22 13:04:27 +0200:
>
>
> > # [EMAIL PROTECTED] / 2005-07-22 09:10:01 +0200:
> > > > # [EMAIL PROTECTED] / 2005-07-21 19:11:04 +0200:
> > > > > I use some updateable views to handle my data (which are
> > > > > amazingly slow), which gives me ultimate flexibility to
> # [EMAIL PROTECTED] / 2005-07-22 09:10:01 +0200:
> > > # [EMAIL PROTECTED] / 2005-07-21 19:11:04 +0200:
> > > > I use some updateable views to handle my data (which
> are amazingly
> > > > slow), which gives me ultimate flexibility to handle my data.
> > > >
> > > > there are some insert ru
# [EMAIL PROTECTED] / 2005-07-22 09:10:01 +0200:
> > # [EMAIL PROTECTED] / 2005-07-21 19:11:04 +0200:
> > > I use some updateable views to handle my data (which are amazingly
> > > slow), which gives me ultimate flexibility to handle my data.
> > >
> > > there are some insert rules which use curr
> # [EMAIL PROTECTED] / 2005-07-21 19:11:04 +0200:
> > I use some updateable views to handle my data (which are amazingly
> > slow), which gives me ultimate flexibility to handle my data.
> >
> > there are some insert rules which use currval() to get the last
> > sequence id for my data which I h
# [EMAIL PROTECTED] / 2005-07-21 19:11:04 +0200:
> I use some updateable views to handle my data (which are amazingly
> slow), which gives me ultimate flexibility to handle my data.
>
> there are some insert rules which use currval() to get the last
> sequence id for my data which I have to inser
Hi all,
I'm still working on my updateable views, which work fine now even I have a
trigger to use because my delete rules wont work, but thats not my current,
more important problem.
I use some updateable views to handle my data (which are amazingly slow), which
gives me ultimate flexibility
I solved it. The statment worked as is, I just had to use dynamic SQL (put
the statement in a string and the EXECUTE the string). Here is what I did:
CREATE FUNCTION test(varchar) RETURNS int2 AS'
DECLARE
id_list ALIAS FOR $1;
query varchar;
BEGIN
query := '' INSERT INTO history (media_id
Am Dienstag, den 12.07.2005, 12:47 -0300 schrieb Adam O'Toole:
> I am trying to INSERT multiple rows to a table using a stored procedure
> something like this:
>
> CREATE FUNCTION test(varchar) RETURNS int2 AS '
> DECLARE
> id_list ALIAS FOR $1;
> BEGIN
> INSERT INTO history (media_id, media_type
Here the media_id will be checked with ('24,25') and not with (24,25).
You might change the datatype from varchar to int array in test function and use "any" in the place of "IN" clause like this,
CREATE FUNCTION test(int[]) RETURNS int2 AS '
DECLARE
id_list ALIAS FOR $1;
BEGIN
INSERT INTO h
I am trying to INSERT multiple rows to a table using a stored procedure
something like this:
CREATE FUNCTION test(varchar) RETURNS int2 AS '
DECLARE
id_list ALIAS FOR $1;
BEGIN
INSERT INTO history (media_id, media_type) SELECT media.media_id,
media.media_type WHERE media.media_id IN (id_list);
Duane,
El 05/08/2004 5:29 PM, Duane Lee - EGOVX en su mensaje escribio:
What table is lnpedpk in - ped_cam? What table is ped_pk in - ped_pro and
ped_cam?
lnPedPk is parameter pased to the function and it could be a fixed value
on the sql console too, ped_pk is common in both tables, I changed th
Hi,
I created a Tables : Create Table address (contry
varchar(20), city varchar(20), zip_code integer),
Create
Table person (Name varchar(20), addr address);
I would know how I can Insert Values in person
table.
note that Po
Hi all,
I'm having some trouble with the insert function and would appreciate
anyones woords of wisdom...
What I'm trying to do in a nutshell:
1. populate a 'working' table from a file (this is fine)
2. run sanity checks on the data (this is fine)
3. merge 'working' tabl
I am pretty much self taught using SQL, and I suspect that my problem
here is trying to do something silly. I have since changed my tables
and avoided the problem, but I am curious as to why this happens, and
it's remotely possible I have even found a bug or two.
I created a table with only a se
On Wed, 23 Jun 1999, abdelkrim wrote:
> it is possible to insert into a view ?
if its a single-table view, yes -- you'd want to create a DO INSTEAD rule.
consult the manual/html pages to get the proper syntax for CREATE RULE.
if its a multitable view, maybe... i dont think this can be done with
it is possible to insert into a view ?
thanks
74 matches
Mail list logo