Re: [GENERAL] INSERT INTO: string with apostrophe

2017-06-29 Thread David G. Johnston
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

Re: [GENERAL] INSERT INTO: string with apostrophe

2017-06-29 Thread Rich Shepard
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

[GENERAL] INSERT INTO: string with apostrophe

2017-06-29 Thread Rich Shepard
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

[GENERAL] INSERT INTO...RETURNING with partitioned table using trigger/rule

2012-06-15 Thread John Lumby
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

Re: [GENERAL] INSERT INTO...RETURNING with partitioned table based on trigger function

2010-12-20 Thread pgsql . 30 . miller_2555
> 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

[GENERAL] INSERT INTO...RETURNING with partitioned table based on trigger function

2010-12-15 Thread pgsql . 30 . miller_2555
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

Re: [GENERAL] insert into test_b (select * from test_a) with different column order

2010-03-30 Thread Szymon Guz
> > > 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

Re: [GENERAL] insert into test_b (select * from test_a) with different column order

2010-03-30 Thread Ole Tange
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

Re: [GENERAL] insert into test_b (select * from test_a) with different column order

2010-03-29 Thread Leif Biberg Kristensen
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);

[GENERAL] insert into test_b (select * from test_a) with different column order

2010-03-29 Thread Ole Tange
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

[GENERAL] Insert into partion table without logic statement

2009-01-05 Thread Jolles, Peter M (GE Infra, Energy)
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

Re: [GENERAL] Insert into ... returning ... before 8.2?

2008-07-02 Thread A. Kretschmer
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

[GENERAL] Insert into ... returning ... before 8.2?

2008-07-02 Thread A B
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

Re: [GENERAL] Insert into master table ->" 0 rows affected" -> Hibernate problems

2008-06-12 Thread Magnus Hagander
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

Re: [GENERAL] Insert into master table ->" 0 rows affected" -> Hibernate problems

2008-06-11 Thread Mattias.Arbin
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

Re: [GENERAL] Insert into master table ->" 0 rows affected" -> Hibernate problems

2008-06-11 Thread Magnus Hagander
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

Re: [GENERAL] Insert into master table ->" 0 rows affected" -> Hibernate problems

2008-06-10 Thread Mattias.Arbin
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

Re: [GENERAL] Insert into master table ->" 0 rows affected" -> Hibernate problems

2008-06-10 Thread Magnus Hagander
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

Re: [GENERAL] Insert into master table ->" 0 rows affected" -> Hibernate problems

2008-06-10 Thread Mattias.Arbin
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

Re: [GENERAL] Insert into master table ->" 0 rows affected" -> Hibernate problems

2008-06-04 Thread Scott Marlowe
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

[GENERAL] Insert into master table ->" 0 rows affected" -> Hibernate problems

2008-06-04 Thread Mattias.Arbin
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

[GENERAL] Insert into master table ->" 0 rows affected" -> Hibernate problems

2008-06-03 Thread Mattias.Arbin
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

Re: [GENERAL] insert into ... select ... and column order

2008-01-15 Thread Tino Wildenhain
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.

Re: [GENERAL] insert into ... select ... and column order

2008-01-15 Thread Tore Halset
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

Re: [GENERAL] insert into ... select ... and column order

2008-01-15 Thread Albe Laurenz
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.

Re: [GENERAL] insert into ... select ... and column order

2008-01-15 Thread Richard Huxton
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.

[GENERAL] insert into ... select ... and column order

2008-01-15 Thread Tore Halset
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

Re: [GENERAL] insert into t1 (delete from t0 returning *)

2007-12-17 Thread Merlin Moncure
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

[GENERAL] insert into t1 (delete from t0 returning *)

2007-12-17 Thread Matthew Dennis
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

Re: [GENERAL] insert into...

2007-12-09 Thread Tom Lane
> "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

Re: [GENERAL] insert into...

2007-12-09 Thread Dave Cramer
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

Re: [GENERAL] insert into...

2007-12-09 Thread Michael Glaesemann
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

[GENERAL] insert into...

2007-12-09 Thread Alain Roger
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

Re: [GENERAL] INSERT INTO row value constructors

2006-12-13 Thread Brandon Aiken
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

Re: [GENERAL] INSERT INTO row value constructors

2006-12-13 Thread Martijn van Oosterhout
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')

[GENERAL] INSERT INTO row value constructors

2006-12-13 Thread Brandon Aiken
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

Re: [GENERAL] Insert into partition table hangs

2006-06-11 Thread Qingqing Zhou
""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

Re: [GENERAL] Insert into partition table hangs

2006-06-10 Thread Nikola Ivanov
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

Re: [GENERAL] Insert into partition table hangs

2006-06-09 Thread Tom Lane
"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 ---

Re: [GENERAL] Insert into partition table hangs

2006-06-09 Thread Qingqing Zhou
"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

Re: [GENERAL] Insert into partition table hangs

2006-06-01 Thread Nik
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

Re: [GENERAL] Insert into partition table hangs

2006-05-26 Thread Nik
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

Re: [GENERAL] Insert into partition table hangs

2006-05-25 Thread Nik
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

Re: [GENERAL] Insert into partition table hangs

2006-05-23 Thread Jim C. Nasby
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

Re: [GENERAL] Insert into partition table hangs

2006-05-23 Thread Nik
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

[GENERAL] Insert into partition table hangs

2006-05-19 Thread Nik
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

Re: [GENERAL] Insert into partition table hangs

2006-05-19 Thread Qingqing Zhou
"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

Re: [GENERAL] insert into a view?

2006-05-03 Thread David Fetter
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

Re: [GENERAL] insert into a view?

2006-05-03 Thread Karen Hill
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 >

Re: [GENERAL] insert into a view?

2006-05-01 Thread Tom Lane
"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

Re: [GENERAL] insert into a view?

2006-05-01 Thread Michael Fuhr
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

[GENERAL] insert into a view?

2006-05-01 Thread Karen Hill
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

Re: [GENERAL] Insert into other database

2006-02-08 Thread Rodolfo Campos
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

Re: [GENERAL] Insert into other database

2006-02-08 Thread Rodolfo Campos
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:

Re: [GENERAL] Insert into other database

2006-02-08 Thread Michael Fuhr
[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

Re: [GENERAL] Insert into other database

2006-02-08 Thread James Harper
> 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 >

Re: [GENERAL] Insert into other database

2006-02-08 Thread Michael Fuhr
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

[GENERAL] Insert into other database

2006-02-08 Thread Rodolfo Campos
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

Re: [GENERAL] Insert into ... Select ... From ... too intelligent transaction

2005-07-22 Thread Roman Neuhauser
# [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

Re: [GENERAL] Insert into ... Select ... From ... too intelligent transaction

2005-07-22 Thread Rose, Juergen
> # [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

Re: [GENERAL] Insert into ... Select ... From ... too intelligent transaction

2005-07-22 Thread Roman Neuhauser
# [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

Re: [GENERAL] Insert into ... Select ... From ... too intelligent transaction

2005-07-22 Thread Rose, Juergen
> # [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

Re: [GENERAL] Insert into ... Select ... From ... too intelligent transaction

2005-07-21 Thread Roman Neuhauser
# [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

[GENERAL] Insert into ... Select ... From ... too intelligent transaction

2005-07-21 Thread Rose, Juergen
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

Re: [GENERAL] INSERT INTO from a SELECT query

2005-07-13 Thread Adam O'Toole
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

Re: [GENERAL] INSERT INTO from a SELECT query

2005-07-13 Thread Tino Wildenhain
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

Re: [GENERAL] INSERT INTO from a SELECT query

2005-07-13 Thread Gnanavel S
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

[GENERAL] INSERT INTO from a SELECT query

2005-07-13 Thread 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) SELECT media.media_id, media.media_type WHERE media.media_id IN (id_list);

Re: [GENERAL] Insert into sintax

2004-08-06 Thread Josué Maldonado
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

[GENERAL] Insert into when the type is an other table

2001-03-19 Thread Mourad EL HADJ MIMOUNE
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

[GENERAL] insert into table from select..

2000-08-09 Thread Dale Walker
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

[GENERAL] Insert into a table with only a SERIAL

2000-06-25 Thread felix
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

Re: [GENERAL] insert into view !!

1999-06-23 Thread Anonymous
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

[GENERAL] insert into view !!

1999-06-23 Thread Anonymous
it is possible to insert into a view ? thanks