Hi,
I'm trying to load data using copy command and STDIN source in command line but the process ends without waiting for records. I think this is first step to load data from a second process without using file source.
Here is the command: mclient -l sql -d database -u user -P pwd -s "COPY INTO table FROM STDIN" It returns immediately with exit code 0.
As far as I know, the "STDIN" input specifier for the "COPY" command refers to the stream where the SQL command came from, and not necessarily standard input. So in your case, the records are expected in the "-s" option argument. I was able to insert records like this: mclient -l sql -d database -u user -P pwd -s "COPY 5 RECORDS INTO some_table FROM STDIN USING DELIMITERS ',','\n';1,2,3 4,5,6 7,8,9 10,11,12 13,14,15 " This thread was rather useful for me to get started with the "COPY" command: [1]. This behaviour for "STDIN" might seem awkward when encountering it for the first time, but it becomes very useful when using Mapi directly without mclient.
With postgresql, the "same" command (psql -U user -h host database -c "\copy table from STDIN") prompt for datas and wait until antislash-dot ("\.") input ends records so it allows a process to load datas using STDIN.
Do you think this is possible with mclient sql copy command?
I haven't tried, but you might be able to emulate something similar by specifying a named pipe as the data source. Best regards, Isidor Zeuner [1] http://article.gmane.org/gmane.comp.db.monetdb.user/1517/match=copy+records+...